【问题标题】:WCF service for Silverlight application returns "NotFound"Silverlight 应用程序的 WCF 服务返回“NotFound”
【发布时间】:2012-02-12 03:37:34
【问题描述】:

我有一个似乎不想工作的 Silverlight 应用程序的 WCF Web 服务。

非常简单;当我同时调试 silverlight 应用程序和 wcf 时,刚刚启动 WCF 后停止工作并抛出以下消息:

CommunicationException 未被用户代码处理。 远程服务器返回错误: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>

任何帮助将不胜感激。

谢谢

【问题讨论】:

  • 您可能试图序列化太多数据。尝试增加buffer size
  • 我已尝试增加最大消息大小,但仍会引发错误。

标签: c# wcf silverlight web-config subsonic


【解决方案1】:

在调试此类问题时,我通常使用 Fiddler (http://fiddler2.com/fiddler2/) 来捕获来自 WCF 的实际响应,这应该会为您提供有关问题的更多详细信息,因为 SL 收到 NotFound 消息隐藏实际的异常。

【讨论】:

  • 刚刚下载并安装了该应用程序,它说我的 Web 服务正在向我的应用程序返回 504 错误。此应用程序是否检测到 wcf 向客户端发送的消息?
  • 它设法下载了我在 WCF 根目录中的 clientaccesspolicy.xml 文件,但实际的数据请求返回 504 错误。
  • 您如何引用 Silverlight 的服务? 添加服务参考是否找到了合适的合同?如果您在 Web 项目中右键单击 .svc 文件,并将其设置为启动页面,它是否正确加载?
  • 是的,Web 服务似乎工作正常。如果我自己调试它,它就会运行,然后我转到localhost:9141/Service1.svc 它有一个默认页面,提供有关如何使用该服务的说明。
  • 那么问题似乎不在于端点,让我们增加服务调用的超时时间。将 &lt;bindings&gt;&lt;basicHttpBinding timeout="01:00" /&gt;&lt;/bindings&gt; 添加到 web.config 中的 system.serviceModel 元素
猜你喜欢
  • 2023-03-30
  • 1970-01-01
  • 2010-12-22
  • 2012-08-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多