问题1 WebService引用失败:
这几天刚下载并安装了Siverlight2.0 Beta 2.0,但经过简单试用后发现存在一个普遍的问题,就是在添加service reference的时候,在d出的‘Add Service Reference’对话框里点击discover时无法自动找到本项目的Web Service,若手工将web service地址 输入后,会出现‘Object reference not set to an instance of an object’这样的错误。
若你也遇到了同样的情况,请先去‘添加/删除软件’里看下Silverlight 2 Beta 2 Tools的安装体积,正常的是1.18M,如果你的是1.4M,那么极有可能是安装问题。有可能你安装了去年12月发布的Blend等软件。
在Silverlight.net论坛找到一种可行的解决办法:
1):确定所有与Silverlight相关的应用程序都被卸载
2):删除以下DLL:
C:/Program files/Microsoft Visual Studio 9.0/Common7/IDE/Microsoft.VisualStudio.ServicesProxy.dll
以上步骤全部完成后,安装Silverlight 2 Beta 2。问题就解决了。
问题2 WCF引用失败:
今天把silverlight2 beta2版本装上了,发现以前在beta1下写的一个程序wcf引用失效,于是就想把wcf引用重新添加一次,结果d出对话框显示"Object reference not set to an instance of an object".为了测试问题的原因,又新建了一个Silverlight Application添加wcf引用,仍然提示这个错误,并且vs.net2008在退出的时候老是提示出现问题提示重新启动。于是Google了一下,找到了解决方法。总结如下:
症状:
1.当添加WCF服务引用的时候出现错误 “Object reference not set to an instance of an object”
2.Silverlight app 不能发现同一个解决方案下的 WCF services
3.添加wcf服务的时候,点击advanced按钮时出现错误“Unable to find ‘DynamicTypeService’”
4.Visual Studio退出时死掉,并且提示重新启动vs studio
解决方法:
1.在Tools – Options – Source Control – Plug-in Selector下将源代码管理插件设置为None
2.删除文件/Program files/Microsoft Visual Studio 9.0/Common7/IDE/Microsoft.VisualStudio.ServicesProxy.dll
3.卸载 Microsoft Silverlight Tools Beta 2 for Visual Studio 2008. 并且重新安装
这样Microsoft.VisualStudio.ServicesProxy.dll被更新为新的版本。
打开vs.net2008问题解决。
问题3 服务跨域问题:
今天将silverlight2 beta1的程序转换成silverlight2 beta2的程序后,发现以前的wcf无法正常调用,vs.net2008 的提示如下:
"An exception of type 'System.ServiceModel.ProtocolException' occurred in System.ServiceModel.dll but was not handled in user code
Additional information: The Remote Server returned an unexpected response: (404) Not Found."
当直接在网页中输入.svc文件的连接地址的时候发现服务是可用的,于是怀疑是客户端跨域访问策略文件(clIEntaccesspolicy.xml )产生的问题,查了下资料,原来是在beta2版本中,策略文件的写法有所改变
Cross-domain restrictions still apply within beta 2 and the same rules apply. There is one subtle change that is required to your clIEntaccesspolicy.xml file that is required. In the allow-from node of the policy file,the attribute http-request-headers is Now required. If your service is an open/public one then specifying “*” is probably acceptable (you’ll have to be the judge of that. If you only wanted to allow specific headers (besIDes the blackListed ones) you can provIDe those in a comma-separated List and can use wildcards as well. For example you Could use X-MyApp-* if you wanted.
Another thing to note about the support for Adobe’s crossdomain.xml policy file is one thing we found in interpretation of the policy template. PrevIoUsly Flash was a Macromedia product and as such that file is adorned with a DOCTYPE that represents a schema with macromedia in it. Well,Adobe has changed the schema a little bit and also updated the DOCTYPE to reflect Adobe as the authority. Right Now,Silverlight still expects to valIDate the macromedia declaration.
于是将clIEntaccesspolicy.xml 的内容修改成如下
<?xml version="1.0" enCoding="utf-8"?>
<access-policy>
<cross-domain-access>
<policy>
<allow-from http-request-headers="*">
<domain uri="*"/>
</allow-from>
<grant-to>
<resource path="/" include-subpaths="true"/>
</grant-to>
</policy>
</cross-domain-access>
</access-policy>
保存修改,重新编译了一下wcf service,在silverlight 的客户端程序中更新对wcf service的引用,运行成功
总结以上是内存溢出为你收集整理的Silverlight 2 升级Beta2 问题整理全部内容,希望文章能够帮你解决Silverlight 2 升级Beta2 问题整理所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)