我有一个 Silverlight 应用程序的 WCF Web 服务,它似乎不想工作。
非常简单;当我同时调试 silverlight 应用程序和 wcf 时,刚启动 WCF 就停止工作并抛出以下消息:
CommunicationException was unhandled by user code. The remote server returned an error: NotFound.
WCF 引用另一个名为 DAL 的代码库,它使用 SubSonic 并存储我正在使用的数据库文件。
这是我的 WCF web.config 文件。似乎有问题,因为其中没有端点,但我不完全确定。
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="Database" connectionString='Data Source=.\SQLEXPRESS;AttachDbFilename="[FILE LOCATION OF MDF FILE]";Integrated Security=True;User Instance=True' providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
如有任何帮助,我们将不胜感激。
谢谢
最佳答案
在调试此类问题时,我通常使用 Fiddler (http://fiddler2.com/fiddler2/) 来捕获来自 WCF 的实际响应,自从 SL 收到 NotFound 消息以来,这应该会为您提供有关该问题的更多详细信息隐藏实际的异常。
关于c# - Silverlight 应用程序的 WCF 服务返回 "NotFound",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9246211/