,我試圖調用的方法調用WCF服務時,有以下特徵:獲得的NullReferenceException從客戶
結果GetPerformanceData(myEntity所實體,布爾遞歸);
我在方法的開始處設置了一個斷點,但在代碼執行到達斷點之前引發了異常。
跟蹤WCF服務給了我以下信息:
System.NullReferenceException,mscorlib程序,版本= 2.0.0.0,文化=中性公鑰= b77a5c561934e089 對象引用不設置到對象的實例。 堆棧跟蹤: 在System.Runtime.Serialization.CodeGenerator.VerifyParameterCount(MethodInfo的MethodInfo的,的Int32 expectedCount) 在System.Runtime.Serialization.CodeGenerator.Call(對象thisObj,的MethodInfo MethodInfo的,對象參數1) 在...
如何確定null變量是什麼?我有我的調試器設置爲打破所有異常,但它並沒有打破這個特定的問題。它看起來像我嘗試調用的方法的「實體」參數無法正確反序列化。
示例調用調用
var results = client。 GetPerformanceData(entity,true);
WCF服務配置
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="All"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "trace.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingSettings" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="5242880" maxBufferPoolSize="52428800" maxReceivedMessageSize="5242880"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="64" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="Company.Service.Engine"
behaviorConfiguration="ServiceBehavior">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8000/Engine"/>
</baseAddresses>
</host>
<endpoint address=""
binding="basicHttpBinding"
bindingConfiguration="basicHttpBindingSettings"
contract="Company.Service.IEngine"/>
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
如果你可以提供調用代碼和WCF配置, – 2009-07-08 00:30:26