Silverlight开发中遇到的几个小问题

Silverlight开发中遇到的几个小问题,第1张

概述1,程序发布时遇到错误:  " Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' "   可能引发此问题的原因: 安

1,程序发布时遇到错误: 

" Could not load type 'System.ServiceModel.Activation.httpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' "

 

可能引发此问题的原因:

安装.NET 4后安装IIS 安装.NET 4后安装3.0版本的WCF http Activation Module 重新将asp.net注册到IIS即可,注意一定是4.0框架下的aspnet_regIIS.exe /iru  不是2.0框架下的 C:\windows\Microsoft.NET\Framework\v4. 0.30319 \aspnet_regIIS.exe  / iru

 

 即可

2,与Socket进行通信时注意端口在4502-4532之间,具体看看策略文件的配置,我因为这个端口问题耽误了一下午,最后才意识到。

3,silverlight的socket方法目前只是提供了客户端的发送和接收方法,如果想做P2P的应用,暂时没有找到解决方法,看到codeplex上有一个 Silverlightp2p的例子,但是代码没有能够运行成功,还请了解silverlightp2p通信的朋友留言相告。

4,silverlight开发中在用到timer时,需要检测控件的线程 *** 作状态才能够赋值,例如

 

代码 if  ( this .textBox1.dispatcher.CheckAccess()) 
            { 
                
this .textBox1.Text  +=  strText  +  Environment.Newline; 
            } 
            
else  
            { 
                
this .textBox1.dispatcher.BeginInvoke(()  =>  {  this .textBox1.Text  +=  strText  +  Environment.Newline; }); 
            }

 

5,在 Silverlight与WEB相结合时可能需要不同的页面调用不同的silverlight控件,我们可以在silverlight项目中app.xaml.cs中加入

 

代码

if  ( ! e.InitParams.ContainsKey( " InitPage " )) 
            { 
                
this .RootVisual  =   new  RIA.Layout.Layout(); 
                
return
            }
            Assembly assembly 
=  Assembly.GetExecutingAssembly(); 
            
string  rootname  =  String.Format( " RIA.{0} " , e.InitParams[ " InitPage " ]); 
            UIElement rootVisual 
=  assembly.CreateInstance(rootname)  as  UIElement; 
            
this .RootVisual  =  rootVisual;

 

 然后再具体的web页面中间加入 

< param name = " InitParams "  value = " InitPage=Test.Mytest "   />

 

 来动态调取 Silverlight 项目中的控件。

随时添加。。。

总结

以上是内存溢出为你收集整理的Silverlight开发中遇到的几个小问题全部内容,希望文章能够帮你解决Silverlight开发中遇到的几个小问题所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1029021.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-23
下一篇2022-05-23

发表评论

登录后才能评论

评论列表(0条)

    保存