如何阻止IISExpress将每个请求的每个细节转储到Visual Studio Output窗口?

时间:2015-03-31 17:41:27

标签: visual-studio iis-express trace

我的VS 2013输出窗口充满了这个:

iisexpress.exe Information: 0 : Request, Method=GET, Url=http://localhost:51741/api/Clients/?$filter=UniqueName eq '6269', Message='http://localhost:51741/api/Clients/?$filter=UniqueName eq '6269''
iisexpress.exe Information: 0 : Message='Clients', Operation=DefaultHttpControllerSelector.SelectController
iisexpress.exe Information: 0 : Message='MyProj.Controllers.ClientsController', Operation=DefaultHttpControllerActivator.Create
iisexpress.exe Information: 0 : Message='MyProj.Controllers.ClientsController', Operation=HttpControllerDescriptor.CreateController
iisexpress.exe Information: 0 : Message='Selected action 'GetClients()'', Operation=ApiControllerActionSelector.SelectAction
iisexpress.exe Information: 0 : Operation=HttpActionBinding.ExecuteBindingAsync
iisexpress.exe Information: 0 : Operation=QueryableAttribute.ActionExecuting
iisexpress.exe Information: 0 : Message='Action returned 'System.Collections.Generic.List`1[MyProj.Models.ClientDto]'', Operation=ReflectedHttpActionDescriptor.ExecuteAsync
iisexpress.exe Information: 0 : Message='Will use same 'JsonMediaTypeFormatter' formatter', Operation=JsonMediaTypeFormatter.GetPerRequestFormatterInstance
iisexpress.exe Information: 0 : Message='Selected formatter='JsonMediaTypeFormatter', content-type='application/json; charset=utf-8'', Operation=DefaultContentNegotiator.Negotiate
iisexpress.exe Information: 0 : Operation=ApiControllerActionInvoker.InvokeActionAsync, Status=200 (OK)
iisexpress.exe Information: 0 : Operation=QueryableAttribute.ActionExecuted, Status=200 (OK)
iisexpress.exe Information: 0 : Operation=ClientsController.ExecuteAsync, Status=200 (OK)
iisexpress.exe Information: 0 : Response, Status=200 (OK), Method=GET, Url=http://localhost:51741/api/Clients/?$filter=UniqueName eq '6269', Message='Content-type='application/json; charset=utf-8', content-length=unknown'
iisexpress.exe Information: 0 : Operation=JsonMediaTypeFormatter.WriteToStreamAsync
iisexpress.exe Information: 0 : Operation=ClientsController.Dispose

如何关掉所有这些?我希望看到的是我的Trace.TraceInformationTrace.TraceErrorTrace.TraceWarning等的来电。

3 个答案:

答案 0 :(得分:16)

首先,当你使用像

这样的代码时
Trace.TraceInformation("My Custom Info Message.");

用于跟踪(无论来自哪个地方 - 页面,控制器或其他类来自单独的.dll)然后在IIS Express下运行您的应用程序,MS VS Output窗口将显示类似

的内容
iisexpress.exe Information: 0 : My Custom Info Message.

你怎么能认识到什么是“你的”以及什么是“不是你的”? 也许您应该为每条消息添加额外的标记?但as I could see输出窗口仍然不支持自定义标签或文本的邮件过滤,但它支持文本搜索(Ctrl + F),所以......

我遇到了与IIS Express垃圾邮件相同的问题,输出窗口包含这样的消息

'iisexpress.exe' (CLR v4.0.30319: /LM/W3SVC/2/ROOT-1-130838650006648508): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

我已经通过MS VS(2013)主菜单解决了这个问题

- > DEBUG - >选项&设置... - >调试 - >输出窗口

并关闭不需要的输出消息类型

General Output Settings

答案 1 :(得分:7)

App_Start\WebApiConfig.cs中,删除config.EnableSystemDiagnosticsTracing();

简单:facepalm:

答案 2 :(得分:0)

添加此功能吗?

<location path="YouSiteName">
    <system.webServer>
        <httpLogging dontLog="true" />
    </system.webServer>
</location>

发现于:http://forums.iis.net/post/1992357.aspx