![](/img/trans.png)
[英]How to increase timeout when import data into Acumatica using webservices API
[英]How to increase timeout while querying data from WebService
我可以在控制器的ActionMethod中查詢Web服務,但是無法在Application Startup中查詢它。
問題描述:我正在ASP.net MVC 5上開發WebApplication,它利用了從SOAP Web服務Autotask API
檢索的數據。 讓我在這里說一下,在用戶可以執行其他操作之前,必須從API加載/緩存一些記錄。
因此,對於WebApp和Webservice之間的通信,
Service Reference
。 ActionMethods
調用Webservice。 我正在努力實現的目標
在生產中,理想的是在應用程序啟動時加載這些記錄。
因此,我將對Web服務的調用從控制器的ActionMethod移到Global.asax.cs
Application_Start()
方法。
但是,當我啟動該應用程序時以及從Webservice查詢數據時。 結果錯誤
內容類型為text / html; 響應消息的charset = utf-8與綁定的內容類型不匹配(text / xml; charset = utf-8)
由於我期望XML格式的數據記錄,因此服務器返回錯誤The remote server returned an error: (500) Internal Server Error.
說明“用戶名和密碼不正確”
但我認為這不是實際情況。 由於兩個堅實的原因
服務器堆棧跟蹤:位於
1 factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory
1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超時)處的System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest請求,HttpWebResponse響應,HttpChannelFactory1 factory, WebException responseException, ChannelBinding channelBinding) at System.ServiceModel.Channels.HttpChannelFactory
)在System.ServiceModel.Channels.ServiceChannel.Call(字符串操作,布爾型單向)的System.ServiceModel.Dispatcher.RequestChannelBinder.Request(消息,TimeSpan超時)處的System.ServiceModel.Channels.RequestChannel.Request(消息,TimeSpan超時) ,ProxyOperationRuntime操作,System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall,ProxyOperationRuntime操作)在System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage消息)處的Object [] ins,Object []輸出,TimeSpan超時
也有內部異常。
在System.Net.HttpWebRequest.GetResponse()在System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan超時)
對我來說,這表明請求超時已過期。 我嘗試將綁定配置修改為以下內容,如此處WCF服務中所述,如何增加超時?
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="ATWS15" />
<binding name="IncreasedTimeout" sendTimeout="00:10:00"></binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://webservices.address.toApi.net/atws.asmx"
binding="basicHttpBinding" bindingConfiguration="IncreasedTimeout" contract="AutoTaskProxy.ATWS15"
/>
</client>
如果有人可以幫助我,我在這里做錯了什么? 我可以在控制器的ActionMethod中查詢Web服務,但無法在Application Startup中查詢它
您有響應超時異常,請嘗試增加receiveTimeout
<bindings>
<basicHttpBinding>
<binding name="ATWS15" />
<binding name="IncreasedTimeout" sendTimeout="00:10:00" receiveTimeout="00:10:00"></binding>
</basicHttpBinding>
</bindings>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.