如何调试 WCF 数据服务?
我有一个托管在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以像这样启用错误日志记录:
在此处查看更多信息: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:
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
此外,您可以订阅对象上下文的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.