简体   繁体   中英

Error logs from a WCF application on IIS 7

This is my own fault, and I'm just missing something obvious. I am building a WCF REST app, on .Net 4.0, and have it working in development, now. I pushed it up to my production server, and get a 500 error after logging in. Now, I'm sure this is an issue with my application, but here's the rub - I have no idea what the error is - I just get a generic 500 error, even if I do it from the lcoalhost. So, I went looking for a log, but there is no entry in the logs under inetpub, just acouple of 400 and 401 errors from some previous experimenting. What am I missing? Where does my WCF app write log entries to? Or do I have to tell it to write 500 errors to a log somewhere, by hand? How would I do that.

WCF apps don't write logs, unless you've adding logging to them.

However the WCF stack can, optionally, write trace files out which you can, sometimes, use to track down the inner exceptions. MSDN has instructions on how to enable and view them.

However that page doesn't show you how to configure file logging, instead this one does. You will need to add an XML trace listener which writes to a file,

        <listeners>
           <add name="traceListener" 
               type="System.Diagnostics.XmlWriterTraceListener" 
               initializeData= "c:\log\Traces.svclog" />
        </listeners>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM