當我打電話從SharePoint網站上的WCF服務,並得到一個錯誤的客戶端上使用下面的細節,當返回比較大的對象圖。模糊WCF錯誤處理大量的對象圖
在調試我可以看到,是服務正確contructs對象和方法返回最終對象(即具有其它對象的列表)正確。但是我在服務方法調用的客戶端發生異常。
你的服務/方法在大多數情況下都能正常工作。下面是該服務的配置(道歉壞格式)
服務配置:
<system.serviceModel>
<services>
<service behaviorConfiguration="StandardServiceBehaviour" name="Thd.K2.Web.DataServicesLibrary.Common.Services.AdminService">
<endpoint address="soap" binding="basicHttpBinding" name="AdminService" contract="Thd.K2.Web.DataServicesLibrary.Common.Interfaces.IAdminService" />
<endpoint address="mex" binding="mexHttpBinding" name="Metadata" contract="IMetadataExchange" kind="mexEndpoint" endpointConfiguration="" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="StandardServiceBehaviour">
<serviceMetadata httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="customBinding" hostNameComparisonMode="StrongWildcard" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:10:00" closeTimeout="00:10:00" maxReceivedMessageSize="1000000" maxBufferSize="1000000" maxBufferPoolSize="1000000" transferMode="Buffered" messageEncoding="Text" textEncoding="utf-8" bypassProxyOnLocal="false" useDefaultWebProxy="true">
<readerQuotas maxDepth="2147483647" maxStringContentLength="214748364" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
<security mode="Transport" />
</binding>
</basicHttpBinding>
<webHttpBinding>
<binding name="webBinding" bypassProxyOnLocal="true" useDefaultWebProxy="false" hostNameComparisonMode="WeakWildcard" sendTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:05:00" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" maxBufferPoolSize="2147483647">
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>
客戶端方法來創建服務實例
public static TServiceType GetServiceClient<TServiceType>(ConnStringsType connectionStringType, Page callingPage)
where TServiceType : class
{
var spUrl = GetConnectionString(connectionStringType, callingPage);
var result = new BasicHttpBinding(BasicHttpSecurityMode.None);
if(spUrl.ToLower().StartsWith("https"))
{
result = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
}
result.MaxReceivedMessageSize = int.MaxValue - 1;
result.MaxBufferSize = int.MaxValue-1;
if (!string.IsNullOrEmpty(spUrl))
{
return (TServiceType)Activator.CreateInstance(typeof(TServiceType), result, new EndpointAddress(spUrl));
}
return null;
}
錯誤:
錯誤佔有在接收到對http://localhost:90/AdminService.svc/soap的HTTP響應的同時,這可能是由於服務端點綁定不使用HTTP協議。這也可能是由於HTTP請求上下文被服務器中止(可能是由於服務關閉)。查看服務器日誌獲取更多詳細信 堆棧:
服務器堆棧跟蹤: 在System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(引發WebException引發WebException,HttpWebRequest的請求,HttpAbortReason abortReason) 在System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(時間跨度超時) at System.ServiceModel.Channels.RequestChannel.Request(Message message,TimeSpan timeout) at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message,TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.Call(String操作,單向布爾值,ProxyOperationRuntime操作,Object [] ins,Object []輸出,TimeSpan超時) 在System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage包括MethodCall,ProxyOperationRuntime操作) 在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(即時聊天消息)[0]時
異常重新拋出: 在System.Runtime。 Remoting.Proxies.RealProxy.HandleReturnMessage(即時聊天reqMsg,即時聊天retMsg) 在System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData & MSGDATA,的Int32類型) 在IAdminService.GetBlackoutPeriodsByDescription(字符串郎,字符串描述) 在AdminServiceClient .GetBlackoutPeriodsByDescription(String lang,字符串描述) at EditBlackoutDates.LoadBlackout(String descriptio n)
你檢查服務器日誌類似錯誤信息提示?他們說什麼? – Randolpho 2012-03-28 15:34:58
我無法注意到服務端的任何錯誤/異常。 – Vashu 2012-03-29 11:39:05