WCF 服务:如何查找服务器日志以了解错误? [英] WCF Service: How to find server logs to understand error?

查看:23
本文介绍了WCF 服务:如何查找服务器日志以了解错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这可能是一个非常基本的问题,但我是 WCF 和服务创建的新手.我正在使用 Microsoft VS 2010 C#4 运行本地托管的 WCF 服务.我试图通过简单绑定通过 URL 运行服务,并通过 URL 运行 PUT 和 GET 方法.我得到:

I know this is probably a pretty basic question but I am brand new to WCF and Service creation. I am running a local hosted WCF service using Microsoft VS 2010 C#4. I am trying to run the service through the URL through simple binding and running the PUT and GET methods through the URL. I am getting the:

.有关更多详细信息,请参阅服务器日志.

. See server logs for more details.

当我尝试提出服务请求时出错.如何找到这些服务器日志?

error when I try to make a service request. How can I find these server logs?

推荐答案

不一定要打开日志记录.需要在 WCF 配置(app.config 或 web.config)中启用跟踪和日志记录.您可以手动执行此操作,也可以单击 app.config,然后选择编辑 WCF 配置.如果此项目没有出现在上下文菜单中(在旧版本的 VS 中发生),您可以在 VS 工具菜单中或通过手动运行(SvcConfigEditor.exe)找到它.

Logging is not necessarily turned on. Tracing and logging need to be enabled in WCF configuration (app.config or web.config). You can do this manually, or by clicking app.config and then selecting Edit WCF Configuration. If this item doesnt appear in context menu (happens in old versions of VS), you can find it in VS Tools menu or by running it manually (SvcConfigEditor.exe).

默认情况下,消息会记录到运行应用程序的目录中的文件中.启用日志记录后,您可以在配置编辑器中对其进行编辑.启用日志记录或跟踪后,编辑器将允许您指定文件路径.

By default, messages are logged to files in directory from which application is ran. You can edit this in configuration editor once you enable logging. Editor will allow you to specify file path once you enable logging or tracing.

您可以稍后使用 Microsoft Service Trace Viewer 工具浏览文件,因为它们是大型 XML 并且对用户不友好.双击日志文件后,查看器工具应该会自动出现,或者您可以手动运行它 (SvcTraceViewer.exe).

You can later use Microsoft Service Trace Viewer tool for going through the files, as large XMLs and are not user friendly. Viewer tool should come up itself once you double click log files, or you can run it manually (SvcTraceViewer.exe).

这篇关于WCF 服务:如何查找服务器日志以了解错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆