如何调试 WCF 数据服务?

发布于 2024-09-30 07:53:18 字数 1091 浏览 6 评论 0原文

我有一个托管在 Asp.Net 网站中的 WCF 数据服务。这是我的 web.config 服务部分:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
 <services>
     <service name="DataServiceHost"
  behaviorConfiguration="DataServiceBehavior">
  <endpoint name="DataServiceHost"
                    address=""
                    binding="webHttpBinding"
                    contract="System.Data.Services.IRequestHandler" />
            </service>
 </services>
 <behaviors>
     <serviceBehaviors>
  <behavior name="DataServiceBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
  </behavior>

我的 InitializeService 方法中有 config.UseVerboseErrors = true;

我按下 F5 进入调试模式,浏览到我的服务,收到错误,尽管它在 VS 中不会中断。我不知所措。

错误顺便说一句:服务器在处理请求时遇到错误。有关更多详细信息,请参阅服务器日志。

我已查找日志...我为该网站设置了 ELMAH,但其中没有任何内容。所以我不确定它在谈论什么服务日志

任何帮助将不胜感激。

I have a WCF Data Service hosted in an Asp.Net website. here is my web.config services section :

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
 <services>
     <service name="DataServiceHost"
  behaviorConfiguration="DataServiceBehavior">
  <endpoint name="DataServiceHost"
                    address=""
                    binding="webHttpBinding"
                    contract="System.Data.Services.IRequestHandler" />
            </service>
 </services>
 <behaviors>
     <serviceBehaviors>
  <behavior name="DataServiceBehavior">
      <serviceDebug includeExceptionDetailInFaults="true"/>
  </behavior>

And I have config.UseVerboseErrors = true; in my InitializeService method.

I hit F5 I go into debug mode, and browse to my service, getting an error, though it doesn't break in VS. I'm at a loss.

the error btw : The server encountered an error processing the request. See server logs for more details.

I've looked for logs... I have ELMAH setup for the site, nothing in there. So I'm not sure what service logs it's talking about.

Any help would be greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

如梦初醒的夏天 2024-10-07 07:53:18

您可以像这样启用错误日志记录:

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="c:\TEMP\web_messages.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>

在此处查看更多信息:http://msdn。 microsoft.com/en-us/library/ms730064.aspx

输出文件可以在记事本或“服务跟踪查看器”中查看 - 请参阅http://msdn.microsoft.com/en-us/library/aa751795.aspx

如果您托管在 IIS 中,则可以使用远程调试:< a href="http://www.codeproject.com/KB/aspnet/IISRemoteDebugging.aspx" rel="nofollow">http://www.codeproject.com/KB/aspnet/IISRemoteDebugging.aspx

You can enable error logging like this:

<system.diagnostics>
    <sources>
      <source name="System.ServiceModel.MessageLogging" switchValue="Warning, ActivityTracing">
        <listeners>
          <add type="System.Diagnostics.DefaultTraceListener" name="Default">
            <filter type="" />
          </add>
          <add name="ServiceModelMessageLoggingListener">
            <filter type="" />
          </add>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add initializeData="c:\TEMP\web_messages.svclog"
        type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
        name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
        <filter type="" />
      </add>
    </sharedListeners>
  </system.diagnostics>

Se more info here: http://msdn.microsoft.com/en-us/library/ms730064.aspx

Output file can be viewed in notedpad or in the "Service Trace Viewer" - see http://msdn.microsoft.com/en-us/library/aa751795.aspx

If you host in IIS you can use remote debugging: http://www.codeproject.com/KB/aspnet/IISRemoteDebugging.aspx

才能让你更想念 2024-10-07 07:53:18

此外,您可以订阅对象上下文的sendingrequest事件: http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.sendingrequest.aspx

然后,在事件处理程序中设置断点并检查请求。

Additionally, you can subscribe to the sendingrequest event of your objectcontext: http://msdn.microsoft.com/en-us/library/system.data.services.client.dataservicecontext.sendingrequest.aspx.

Then, set a breakpoint in the event handler and inspect the request.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文