![](/img/trans.png)
[英]Asp.Net Asmx Webservice Method working in localhost but i am getting error in Server
[英]ASMX WebService not working on LIVE server
我有一個連接到SQL數據庫的簡單ASMX Web服務。 我也有隨附的webservice測試器應用程序。
我已經在開發機器和自己的Windows 2008服務器上測試了這兩個組件。 當我將其部署到客戶的服務器上時,無論在服務器上還是在遠程調用,webservices服務登錄頁面都可以正常工作,但是,webservice測試器根本無法在任何位置運行。 拋出異常
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive.
System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at WebServiceTester.frmMain.btnCallWS_Click`
發生錯誤時,Windows事件查看器,SQL日志或IIS日志中均不顯示任何內容。 任何想法可能是什么原因造成的?
您是否要處理大型請求? IIRC正確,默認最大為4MB,您會收到此錯誤。
在Web.config文件中,為應用程序覆蓋maxRequestLength的值。 例如,Web.config中的以下條目允許上傳小於或等於1 GB的文件:
<httpRuntime maxRequestLength="1048576" />
IIRC在2.0框架中的絕對最大值為2GB,請不要尋找理由嘗試更大的值。
編輯-更多細節
有些防火牆可以區分GET和POST請求,因此可能使用瀏覽器進行GET,但在POST中被阻止。 如果您想調試網絡流量,則可以在Chrome瀏覽器中復制POST(通過JQuery輕松連接硬編碼的帖子),會發現更容易,然后可以使用瀏覽器檢查標題等。或者,您可以使用Fiddler(一個出色的應用程序),請參閱為Fiddler配置.NET應用程序以使用Fiddler調試測試應用程序(假設它是基於堆棧跟蹤的Winform應用程序)
終於深入到此。 必須按照以下說明使用Windbgx86分析w3wp.exe崩潰小型轉儲並從Microsoft和sos.dll加載符號,網址為http://vstepic.blogspot.co.uk/2012/03/how-to-debug-iis -75-application-pool.html (請非常感謝該文檔的作者!!!)
唯一的區別是我必須運行“!pe -nested”而不是“!CLRstack”。
這轉儲了幾條都帶有相同錯誤的消息。 服務器上缺少庫DLL。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.