获取使用asmx Web服务的错误作为添加服务引用

时间:2013-10-15 10:22:46

标签: c# asp.net wcf web-services visual-studio-2012

我创建了一个示例Web应用程序,它使用添加服务引用来使用旧的asmx Web服务(已经托管在网络服务器上)。当我在visual studio 2012中运行这个应用程序而没有额外的设置时,它已经创建了端点,basicHttpBinding等。在我发布并将其托管在IIS上之后,它会出现如下错误:

远程主机强行关闭现有连接   描述:执行当前Web请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。

异常详细信息:System.Net.Sockets.SocketException:远程主机强行关闭现有连接

来源错误:

  

在执行当前Web请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息。

堆栈追踪:

[SocketException (0x2746): An existing connection was forcibly closed by the remote host]
   System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +6508791
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +130

[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
   System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +296
   System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size) +19
   System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead) +251

[WebException: The underlying connection was closed: An unexpected error occurred on a receive.]
   System.Net.HttpWebRequest.GetResponse() +6442392
   System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +55

[CommunicationException: An error occurred while receiving the HTTP response to (http://"web service path"). This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +10618399
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +336
   TestEvantekWebApp.wsCMA.CMAMobileSoap.GetQueueInfo(GetQueueInfoRequest request) +0
   TestEvantekWebApp.wsCMA.CMAMobileSoapClient.TestEvantekWebApp.wsCMA.CMAMobileSoap.GetQueueInfo(GetQueueInfoRequest request) in c:\Users\vishwajeet.kulkarni\Documents\Visual Studio 2012\Projects\TestEvantekWebApp\TestEvantekWebApp\Service References\wsCMA\Reference.cs:721
   TestEvantekWebApp.wsCMA.CMAMobileSoapClient.GetQueueInfo(String tenantID, Int32 pax) in c:\Users\vishwajeet.kulkarni\Documents\Visual Studio 2012\Projects\TestEvantekWebApp\TestEvantekWebApp\Service References\wsCMA\Reference.cs:729
   TestEvantekWebApp.TestEvantekPage.Page_Load(Object sender, EventArgs e) in c:\Users\vishwajeet.kulkarni\Documents\Visual Studio 2012\Projects\TestEvantekWebApp\TestEvantekWebApp\TestEvantekPage.aspx.cs:21
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Web应用程序的Web.config文件:

<configuration>
  <configSections>
  </configSections>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" maxRequestLength="102400" />    
  </system.web>
  <system.webServer>
    <directoryBrowse enabled="true"/>
  </system.webServer>
  <system.serviceModel>    
    <protocolMapping>
      <add binding="basicHttpBinding" scheme="Web"/>
    </protocolMapping>
    <bindings>
      <basicHttpBinding>
        <binding name="CMAMobileSoap" closeTimeout="00:01:00"
                     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />          
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://1.1.1.1/capitaws/CMAMobile.asmx"
          binding="basicHttpBinding" bindingConfiguration="CMAMobileSoap"
          contract="wsCMA.CMAMobileSoap" name="CMAMobileSoap">
        <identity>
          <dns value="1.1.1.1"/>
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>
</configuration>

0 个答案:

没有答案