2016-03-03 230 views
0

當我的asp.net Web應用程序試圖從CodeBehind訪問另一個Web服務時,出現錯誤消息「遠程服務器返回了意外響應:(440)440。 「 在Chrome開發工具中,我提取了異常類型:「System.ServiceModel.ProtocolException」遠程服務器返回意外響應:(440)

使用我正在聯繫的遠程Web服務的舊版本,它似乎工作正常。我能想到的唯一改變就是我的IDE版本。我最近從Visual Studio 2013切換到Visual Studio 2015.關於Web服務/服務參考技術有什麼改變嗎? 從WebMethod返回結果時拋出異常,.NET框架也沒有更改。

說到錯誤代碼,我不確定它是否是HTTP錯誤代碼,440似乎意味着不允許發佈。我在測試服務器和IIS Express版本10上運行IIS7,就像從HTTP請求中看到的那樣。

服務器堆棧跟蹤:

at System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory factory, WebException responseException, ChannelBinding channelBinding) 
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) 
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 action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) 
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs) 
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) 
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 

堆棧跟蹤表明某種代理相關的電話,但沒有代理用於此調用。

請讓我知道,如果您需要更多的細節,請提前致謝。

回答

0

可能兩個版本的web.config文件都有所不同。

  1. 在最新版本中創建新項目。
  2. 獲取新建項目的web.config並應用您現有的web.config文件的設置。
  3. 重新上傳web.config文件。

這將解決問題。

+0

感謝您的建議,我應該爲遠程Web服務項目還是我正在訪問遠程Web服務的項目執行此操作? – vm370

+0

更新:我剛剛爲遠程Web服務項目做了這個,我不得不從這個web.config中刪除幾個條目,甚至讓它工作。替換web.config文件後,出現同樣的問題。 – vm370

+0

如果兩個項目都是在舊版本中開發的,那麼您應該爲兩個項目都這樣做,因爲兩個項目的web.config文件都有不同的配置條目。你需要比較。 –

相關問題