简体   繁体   English

将对WCF服务的引用添加到Silverlight 4项目时,显示“对象引用未设置为对象的实例”错误

[英]“Object reference not set to an instance of an object” error shows when adding a reference to a WCF service to a Silverlight 4 project

I have a Silverlight enabled WCF service, and a Silverlight 4 project that references it. 我有一个启用Silverlight的WCF服务,还有一个引用了它的Silverlight 4项目。

The service used to work nicely until I merged some changes another developer made into the service, since then the Silverlight project failed to call the service with "Server not found" error. 直到我将其他开发人员对服务进行的一些更改合并到该服务之前,该服务一直运行良好,因为此后Silverlight项目无法使用“找不到服务器”错误调用该服务。

I removed the reference to the service, tried to add it again but this failed with error "Object reference not set to an instance of an object". 我删除了对服务的引用,尝试再次添加它,但这失败,并显示错误“对象引用未设置为对象的实例”。

This is not limited to the above service anymore, this error happens every time I try to add any WCF service to the Silverlight project. 这不再局限于上述服务,每次我尝试将任何WCF服务添加到Silverlight项目时,都会发生此错误。

I am using Visual Studio 2010 and the .NET Framework 4.0 for all projects. 我对所有项目都使用Visual Studio 2010和.NET Framework 4.0。 This problem has happened before and I was able to solve it be creating a new solution, creating fresh projects in it and then adding the code files to the projects one by one. 这个问题以前已经发生过,我能够通过创建一个新的解决方案来解决它,在其中创建新的项目,然后将代码文件一个接一个地添加到项目中。 However, this is a nightmare now that my solution contains dozens of projects and hundreds of code files. 但是,既然我的解决方案包含数十个项目和数百个代码文件,这将是一场噩梦。

anyone out there with a fix for this? 有人为此解决吗? I googled this a dozen times and all I got was fixes to similar problems that happened with Silverlight 2 and Visual Studio 2008, but these fixes didn't work for me. 我在Google上搜索了12次,而我所得到的仅仅是针对Silverlight 2和Visual Studio 2008所发生的类似问题的修复程序,但这些修复程序对我而言不起作用。

Thanks. 谢谢。

Make sure your WCF service is working properly. 确保您的WCF服务正常运行。 Right click on the SVC file and select View in browser. 右键单击SVC文件,然后选择在浏览器中查看。 If there is a runtime problem, that should point you in the right direction. 如果存在运行时问题,那应该为您指明正确的方向。

Have you tried switching WCF tracing on? 您是否尝试过打开WCF跟踪? I find it normally provides clues to the problem source. 我发现它通常可以为问题源提供线索。 Also, have you checked your Silverlight client config? 另外,您是否检查了Silverlight客户端配置? Are the end point addresses all correct? 终点地址都正确吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Silverlight添加到列表 <T> 抛出未设置为对象实例的对象引用 - Silverlight adding to List<T> throws Object reference not set to an instance of an object 在Silverlight中使用WCF时添加服务引用有什么问题? - What is wrong with adding a service reference when consuming WCF in Silverlight? 使用WCF服务添加Silverlight应用程序的服务参考 - Adding service reference for Silverlight Application with WCF services EF5 Code First和RIA Services Silverlight“对象引用未设置为对象的实例”错误构建客户端 - EF5 Code First and RIA Services Silverlight “Object reference not set to an instance of an object” error building client WCF Silverlight服务参考 - WCF Silverlight Service Reference 在Silverlight项目中向WCF服务添加服务引用,默认为DataMembers的XmlSerialization而不是SOAPSerilaization - Adding Service Reference to a WCF Service in Silverlight project defaulting to XmlSerialization for DataMembers instead of SOAPSerilaization 在创建新项目时,我收到错误“对象引用未设置为对象的实例” - While creating new project I am getting error “object reference not set to an instance of an object” 如何在WCF服务中引用Com对象 - How To Reference a Com Object in a WCF Service 在Silverlight中处理数据网格时对象引用错误 - Object reference error while dealing with datagrid in Silverlight 如何在Silverlight中动态更新WCF服务参考? - How to update WCF service reference dynamically in silverlight?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM