2012-06-18 62 views
0

我搜索了互聯網,但找不到像我正在使用的任何場景。該場景是我有一個ASP.NET MVC 3報表應用程序和獨立的WCF託管服務。我正在爲ASP.NET MVC 3做一個bin部署。在我的本地環境和開發服務器上,一切都很好。我在ASP.NET MVC項目中使用服務引用來調用客戶端代理。ASP.NET MVC 3 WCF不能在負載平衡服務器上工作

但是,當我部署到負載平衡的客戶端測試環境(ASP.NET和WCF層都位於相同的負載平衡服務器上)時,它將失敗。如果我運行我的本地構建,並將我的端點指向他們的開發wcf服務,它工作正常。它只在嘗試從測試URL本身啓動應用程序時失敗。我收到以下錯誤(編輯端點和服務呼叫信息:

「System.ServiceModel.CommunicationException:當 接收到http HTTP響應時出現錯誤:[TESTSERVER]這可能是由於 服務端點綁定不使用HTTP協議,這也可能是由於服務器 (可能是由於服務關閉)導致HTTP請求上下文中止導致的。請參閱服務器日誌以獲取更多詳細信息。 .Net.WebException:底層連接是 closed:接收時發生意外錯誤---> System.IO.IOException:無法讀取數據來自傳輸 連接:現有連接被遠程 主機強制關閉。 ---> System.Net.Sockets.SocketException:現有連接 被遠程主機強制關閉,位於 System.Net.Sockets.NetworkStream.Read(Byte [] buffer,Int32 offset, Int32 size)---內部異常堆棧跟蹤結尾---在System.Net.PooledStream.Read(Byte []緩衝區,Int32 偏移量爲 System.Net.Sockets.NetworkStream.Read(Byte []緩衝區,Int32偏移量, Int32大小) ,Int32大小)在System.Net.Connection.SyncRead(HttpWebRequest 請求,布爾userRetrievedStream,布爾probeRead)--- 內部異常堆棧跟蹤---在 System.Net.HttpWebRequest.GetResponse()在 系統結束系統.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(蒂姆ESPAN 超時)內部異常堆棧跟蹤的結束--- ---服務器堆棧 跟蹤:在在 System.ServiceModel.Channels System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(引發WebException 引發WebException,HttpWebRequest的請求,HttpAbortReason abortReason) .HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(時間跨度 超時)在 System.ServiceModel.Channels.RequestChannel.Request(消息消息,時間跨度 超時)在 System.ServiceModel.Channels.ServiceChannel.Call(字符串動作, 布爾單向,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類型)在 ReportingApp.UserClientProxy.IUser.GetUsersBetween(日期時間開始, 日期時間結束)在 ReportingApp。Controllers.HomeController.PopulateResultsTable(ReportingViewModel VM)在ReportingApp.Controllers.HomeController.Index()在 lambda_method在 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext (封閉,ControllerBase,對象[])controllerContext,IDictionary的2 parameters) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary 2個 參數)在 System.Web.Mvc.ControllerActionInvoker。 <> C_ DisplayClass15.b _12() 在 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter 濾波器,ActionExecutingContext preContext,函數功能1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList 1個濾波器,ActionDescriptor actionDescriptor, IDictionary`2參數)在 的System.Web .Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext,字符串actionName)」

我的ASP.NET WCF配置如下:

<bindings> 
     <basicHttpBinding> 
     <binding name="BasicHttpBinding_IUser" closeTimeout="00:10:00" 
      openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" 
      allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
      maxBufferSize="5242880" maxBufferPoolSize="5242880" maxReceivedMessageSize="5242880" 
      messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
      useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="5242880" maxStringContentLength="5242880" maxArrayLength="5242880" 
      maxBytesPerRead="5242880" maxNameTableCharCount="5242880" /> 
      <security mode="None" > 
      <transport clientCredentialType="None" proxyCredentialType="None" realm=""/> 
      <message clientCredentialType="UserName"/> 
      </security> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <client> 
     <endpoint address="[testEndPoint]" binding="basicHttpBinding" 
     bindingConfiguration="BasicHttpBinding_IUser" contract="UserClientProxy.IUser" 
     name="BasicHttpBinding_IUser" /> 

我服務的web配置是這樣的:

<behaviors> 
     <serviceBehaviors> 
     <behavior> 
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata httpGetEnabled="true"/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="false"/> 
      <!--Doubled from value again to resolve issues with the reporting process.--> 
      <dataContractSerializer maxItemsInObjectGraph="524288" /> 
     </behavior> 
     </serviceBehaviors> 
    </behaviors> 
    <bindings> 
     <basicHttpBinding> 
     <binding maxBufferSize="5242880" maxBufferPoolSize="5242880" maxReceivedMessageSize="5242880"> 
      <readerQuotas maxDepth="5242880" maxStringContentLength="5242880" maxArrayLength="5242880" 
      maxBytesPerRead="5242880" maxNameTableCharCount="5242880" /> 
     </binding> 
     </basicHttpBinding> 
    </bindings> 
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> 
    </system.serviceModel> 
<system.webServer> 
    <modules runAllManagedModulesForAllRequests="true"/> 
    </system.webServer> 

任何想法,可能會造成這個問題?它可能是一個權限問題或配置問題?我很困惑,因爲它從我的本地構建指向客戶端測試環境端點。

預先感謝您!

+0

我在想,你的意思是你有你的web服務的web配置和您的asp.net MVC web配置?而不是asp.net WCF配置? – EdmundYeung99

+0

你在哪裏定義你的服務端點? – EdmundYeung99

+0

嗨埃德蒙,是的我有我的asp.net mvc網絡配置和我的網絡服務網絡配置。我的端點實際上指向DNS服務器名稱。我當時認爲這可能是防火牆或DNS將服務調用重新路由到其他服務。 –

回答

0

我知道這個答案是晚了,但我們也有類似的問題,我的REST服務,他們工作得很好我們的開發服務器,那麼他們停止工作,當我們部署他們的負載均衡池和他們打了一個電話到另一個該服務也位於負載平衡池中。

我們能夠獲得呼叫工作,一旦我們打開源地址轉換。我們的網絡管理員必須將F5池中的翻譯設置設置更改爲SNAT池。此鏈接有更多關於您的網絡人員的信息。

https://support.f5.com/kb/en-us/products/lc_9_x/manuals/product/lc_config_guide_10_1/lc_addrtrans.html

所以這可能幫助時工作正常服務,稱東西是負載均衡時,現在失敗的情況。