WCF服务跟踪
如果在开发过程中,WCF服务出现问题,我们可以通过服务引用,然后直接断点调试进去。然而,对于已经发布的服务,出现错误时,寻找错误信息会变得麻烦。
幸好,微软提供了服务跟踪查看器工具 (SvcTraceViewer.exe)这个工具来跟踪已发布的服务。
可以在文件夹: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin找到(我的系统是WIN7,.NET 4.0)

配置服务跟踪相当简单,可以用上面的SvcConfigEditor.exe来打开服务的config文件配置。
也可以手动修改配置,增加一个diagnostics的配置节点。
<?xml version="1.0" encoding="utf-8"?>
<configuration> <system.web>
<compilation targetFramework="4.5" />
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<!--添加跟踪节点-->
<diagnostics>
<messageLogging logEntireMessage="true" logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
</diagnostics>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- 为避免泄漏元数据信息,请在部署前将以下值设置为 false -->
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<!-- 要接收故障异常详细信息以进行调试,请将以下值设置为 true。在部署前设置为 false 以避免泄漏异常信息 -->
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="ServiceProxyBinding" closeTimeout="00:10:00" receiveTimeout="00:10:00"
sendTimeout="00:10:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxStringContentLength="2147483647" />
</binding>
<binding name="BasicHttpBinding_IAircraftService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647" />
<binding name="BasicHttpBinding_ITransCenter" />
<binding name="BasicHttpBinding_IDecodeService" />
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://192.168.85.70:5596/TransCenterSer.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ITransCenter"
contract="TransCenterSer.ITransCenter" name="BasicHttpBinding_ITransCenter" />
<endpoint address="http://192.168.85.70:8010/AHMTService/DecodeService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDecodeService"
contract="DecodeService.IDecodeService" name="BasicHttpBinding_IDecodeService" />
</client>
</system.serviceModel>
<!--配置跟踪节点-->
<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>
<source name="System.ServiceModel" switchValue="Warning, ActivityTracing"
propagateActivity="true">
<listeners>
<add type="System.Diagnostics.DefaultTraceListener" name="Default">
<filter type="" />
</add>
<add name="ServiceModelTraceListener">
<filter type="" />
</add>
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="D:\LogData\MoveQarData_messages.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
<add initializeData="D:\LogData\MoveQarData_tracelog.svclog"
type="System.Diagnostics.XmlWriterTraceListener, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
<filter type="" />
</add>
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
若要在调试过程中浏览 Web 应用程序根目录,请将下面的值设置为 True。
在部署之前将该值设置为 False 可避免泄露 Web 应用程序文件夹信息。
-->
<directoryBrowse enabled="true"/>
</system.webServer>
</configuration>
参考:http://msdn.microsoft.com/zh-cn/library/ms732023.aspx
http://www.cnblogs.com/cbcye/archive/2009/06/02/1494734.html
http://www.cnblogs.com/cnblogsfans/archive/2009/03/16/1413069.html
WCF服务跟踪的更多相关文章
- 关于WCF服务的调试跟踪
关于WCF服务的调试跟踪信息,请利用好以下几个工具,具体的例子MSDN上都有,进去看吧... 服务跟踪查看器工具 (SvcTraceViewer.exe): http://msdn.microsoft ...
- Entity Framework 6 Recipes 2nd Edition(9-7)译->在WCF服务中序列化代理
9-7. 在WCF服务中序列化代理 问题 从一个查询里返回一个动态代理对象,想要把它序列为一个POCO(Plain-Old CLR Objects)对象. 实现基于POCO实体对象, 在运行时,EF会 ...
- WCF学习之旅—WCF服务部署到IIS7.5(九)
上接 WCF学习之旅—WCF寄宿前的准备(八) 四.WCF服务部署到IIS7.5 我们把WCF寄宿在IIS之上,在IIS中宿主一个服务的主要优点是在发生客户端请求时宿主进程会被自动启动,并且你可以 ...
- WCF初探-8:WCF服务承载 (上)
前言 任何一个程序的运行都需要依赖一个确定的进程中,WCF服务也不例外.如果使用WCF服务,我们就必须将服务承载于创建它并控制它的上下文和生存期的运行时环境中,承载服务环境的程序,我们称之为宿主.WC ...
- WCF服务运行一段时间后客户端无法连接WCF服务的解决办法 (转)
WCF服务运行一段时间后客户端无法连接WCF服务的解决办法 (转) Windows Communication Foundation (WCF)是Microsoft为构建面向服务的应用提供的分布式通信 ...
- 编写寄宿于windows服务的WCF服务
由于业务中有些任务需要在后台静默长期运行,或者有些服务队响应的要求比较苛刻,这样的WCF服务就不适合寄宿于IIS中.IIS每隔一段时间w3wp进程会闲置超时,造成服务的运行停止,因此这种耗时或者定时任 ...
- 练习 配置WCF服务
http://blog.csdn.net/suntanyong88/article/details/8203572 目录(?)[+] 1OrderTrackWindowsKZT 控制台应用 程 ...
- WCF系列教程之WCF服务宿主与WCF服务部署
本文参考自http://www.cnblogs.com/wangweimutou/p/4377062.html,纯属读书笔记,加深记忆. 一.简介 任何一个程序的运行都需要依赖一个确定的进程中,WCF ...
- WCF服务调用超时错误:套接字连接已中止。这可能是由于处理消息时出错或远程主机超过接收超时或者潜在的网络资源问题导致的。本地套接字超时是“00:05:30”(已解决)
问题: 线上正式环境调用WCF服务正常,但是每次使用本地测试环境调用WCF服务时长就是出现:套接字连接已中止.这可能是由于处理消息时出错或远程主机超过接收超时或者潜在的网络资源问题导致的.本地套接字超 ...
随机推荐
- 提交上了,却在iTunes Connect没有新版本的任何消息
上架的时候,收到这样的邮件 This app attempts to access privacy-sensitive data without a usage description. The ap ...
- cf319.B. Modulo Sum(dp && 鸽巢原理 && 同余模)
B. Modulo Sum time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...
- 又一个绝对棒的对话框插件fancybox v1.3.4
http://www.jsfoot.com/jquery/demo/2011-07-30/fancybox/index.html jquery插件:fancybox Fancybox的特点如下: ...
- Codeforces 271 Div 2 C. Captain Marmot
题目链接:http://codeforces.com/contest/474/problem/C 解题报告:给一个n,然后输入4*n个平面坐标系上的点,每四个点是一组,每个点有一个中心,这四个点可以分 ...
- iOS9 beta 请求出现App Transport Security has blocked a cleartext HTTP (http://)
iOS9 beta 请求出现App Transport Security has blocked a cleartext HTTP (http://) http://www.bubuko.com/in ...
- Sqli-LABS通关笔录-3
/*此时心情xxxx*/ 通过这一关卡我学习到了 1.大概的能够mysql回显错误注入的面目,可以根据报错,写出闭合语句. 加一个单引号.报错如下所示. 加了一个单引号就说 1'') LIMIT 0, ...
- 51Nod 1250 排列与交换
Description 统计 \(1...n\) 的排列,恰好进行 \(k\) 次相邻交换和至多进行 \(k\) 次交换生成的不同的序列个数. Sol DP. 好妙的题啊... 首先看第一个问题. 对 ...
- CodeVS 1344 线型网络
Sol 随机化算法+哈密顿路径. 好厉害的题...首先都会想到状压DP对吧,复杂度 \(O(n^2 2^n)\) . \(n=20\) exm?? \(10^8\) 有一种算法就是随机化算法 再调整 ...
- 9.2---机器人走方格(CC150)
这题就是dp的一般题目 public static int countWays(int x, int y){ if( x < 0 || y < 0) return -1; int[][] ...
- 使用jar命令打war包
1.打开cmd进入web项目发布文件夹 2.,输入jar -cvf qxpt.war * (*表示当前目录下所有子目录) 3,回车等待执行完成就可以了 4.如果web项目发布文件夹有多个文件夹,而打w ...