我搜索了互联网,但找不到任何像我这样的场景。场景是我有一个 ASP.NET MVC 3 报告应用程序和独立的 WCF 托管服务。我正在为 ASP.NET MVC 3 进行 bin 部署。在我的本地环境和开发服务器上一切正常。我在 ASP.NET MVC 项目中使用服务引用来调用客户端代理。
但是,当我部署到负载平衡的客户端测试环境(ASP.NET 和 WCF 层都位于相同的负载平衡服务器上)时,它失败了。如果我运行本地构建并将端点指向他们的开发 wcf 服务,它工作正常。只有在尝试从测试 URL 本身启动应用程序时才会失败。我收到以下错误(编辑了端点和服务调用信息:
“System.ServiceModel.CommunicationException:接收对 http:[testserver] 的 HTTP 响应时发生错误。这可能是由于服务端点绑定未使用 HTTP 协议。这也可能是由于 HTTP 请求上下文被中止服务器(可能是由于服务关闭)。有关更多详细信息,请参阅服务器日志。---> System.Net.WebException:底层连接已关闭:接收时发生意外错误。---> System.IO .IOException:无法从传输连接读取数据:现有连接被远程主机强制关闭。---> System.Net.Sockets.SocketException:现有连接被远程主机在 System.Net 强制关闭。 Sockets.NetworkStream.Read(Byte[] 缓冲区,Int32 偏移量,Int32 size) --- 内部异常堆栈跟踪结束 --- 在 System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) at System.Net.PooledStream.Read(Byte[] buffer , Int32 偏移量, Int32 大小) 在 System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) --- 内部异常堆栈跟踪结束 --- 在 System.Net.HttpWebRequest.GetResponse() 处。 ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- 内部异常堆栈跟踪结束 --- 服务器堆栈跟踪:在 System.ServiceModel.Channels.HttpChannelUtilities.ProcessGetResponseWebException(WebException webException, HttpWebRequest request, HttpAbortReason abortReason ) 在 System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel。HttpChannelRequest.WaitForReply(TimeSpan timeout) at System.ServiceModel.Channels.RequestChannel.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.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) 在 [0] 处重新抛出异常:在 System.Runtime。 Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at ReportingApp.UserClientProxy.IUser.GetUsersBetween(DateTime start,DateTime end) at ReportingApp.Controllers.HomeController.PopulateResultsTable(ReportingViewModel vm) at ReportingApp.Controllers.HomeController.Index() at lambda_method(Closure , ControllerBase , Object[] ) at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext,字典
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,Func1 continuation) at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList
1 过滤器,ActionDescriptor actionDescriptor,IDictionary`2 参数)在 System.Web.Mvc.ControllerActionInvoker.InvokeAction(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" />
我的服务网络配置如下所示:
<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>
知道可能导致此问题的原因是什么吗?可能是权限问题还是配置问题?我很困惑,因为它从我的本地构建指向客户端测试环境端点工作。
先感谢您!