Silverlight RIA服务应用程序中的不完整WCF日志文件

时间:2017-06-23 01:56:52

标签: c# wcf silverlight wcf-ria-services

我有一个silverlight + RIA Services应用程序。它在我的开发环境中运行正常。但是在生产中,我在调用RIA Services中的任何方法来获取某些实体时会收到错误。我正在执行的命令是:

context.Load<MyEntity>(context.GetMyEntityQuery(), LoadBehavior.RefreshCurrent,
   lo => { 
       ... Get the results ...
   });

我收到了这个错误:

Load operation failed for query 'GetItemGradeCurricularPorSerie'. 
[HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging Resource strings are unavailable. See http://go.microsoft.com/fwlink/?linkid=106663&Version=5.1.40416.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer

每当我的开发环境中出现“NotFound”错误时,我都会设置WCF将其操作记录在日志文件中,而日志文件我可以找到有关错误的详细信息。所以我用以下配置做到了:

<system.diagnostics>
    <sources>
        <source propagateActivity="true" name="System.ServiceModel" switchValue="Warning, ActivityTracing">
            <listeners>
                <add type="System.Diagnostics.DefaultTraceListener" name="Default">
                    <filter type="" />
                </add>
                <add initializeData=".\logs\MyApp.Traces.svclog"
                    type="System.Diagnostics.XmlWriterTraceListener" name="traceListener">
                    <filter type="" />
                </add>
            </listeners>
        </source>
        <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>
    </sources>
   <sharedListeners>
        <add initializeData=".\logs\MyApp_tracelog.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
            <filter type="" />
        </add>
        <add initializeData=".\logs\MyApp_messages.svclog"
            type="System.Diagnostics.XmlWriterTraceListener, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
            name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
            <filter type="" />
        </add>
    </sharedListeners>
    <trace autoflush="true" indentsize="4" />
</system.diagnostics>
(...)
<system.serviceModel>
    <diagnostics performanceCounters="Off">
        <messageLogging logEntireMessage="true" logKnownPii="true" logMalformedMessages="true"
            logMessagesAtServiceLevel="false" logMessagesAtTransportLevel="true"
            maxSizeOfMessageToLog="2000000000" />
        <endToEndTracing propagateActivity="true" activityTracing="true"
            messageFlowTracing="true" />
    </diagnostics>
(...)
</system.serviceModel>

通过上面的配置,在开发机器中,我得到了一个MyApp.Traces.svlog和MyApp_messages.svlog。在其中一个文件中,我找到了真正的错误消息。但是,当我尝试在生产服务器中执行此操作时,我只获得MyApp.Traces.svlog,并且其不完整:

<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
        <EventID>0</EventID>
        <Type>3</Type>
        <SubType Name="Transfer">0</SubType>
        <Level>255</Level>
        <TimeCreated SystemTime="2017-06-22T21:30:11.6757512Z" />
        <Source Name="System.ServiceModel" />
        <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" RelatedActivityID="{96fc137e-346c-45de-80d0-34b59e461607}" />
        <Execution ProcessName="        
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
    <System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
        <EventID>131085</EventID>
        <Type>3</Type>
        <SubType Name="Start">0</SubType>
        <Level>255</Level>
        <TimeCreated SystemTime="2017-06-22T21:30:11.7069040Z" />
        <Source Name="System.ServiceModel" />
        <Correlation ActivityID="{96fc137e-346c-45de-80d0-34b59e461607}" />
        <Execution ProcessName="

Xml元素在<Execution ProcessName="行停止。

毕竟,我的问题是:为什么日志文件不完整?可能导致这种情况的原因是什么?

顺便说一下,服务器不接受完整的信任程序集,我不知道它是否相关。

如果有人对错误本身有一些提示,我也会感激不尽,但重点是获取正确的错误信息,因此它也有助于将来的错误。

0 个答案:

没有答案