尝试更新或删除/添加时出现服务引用错误

时间:2015-10-16 15:00:37

标签: c# asp.net binding

我几天来一直在寻找我的服务参考错误的答案而没有任何变化。几个月前我对这个网络应用程序进行了一些更改,我能够毫无问题地更新服务参考。现在,我最近做了几乎相同的更改,但无法在没有错误的情况下更新解决方案中的服务引用: 出现错误

downloading 'http://localhost:57903/CreateServiceCall.xamlx/_vti_bin/ListData.svc/$metadata'.
The request failed with the error message:
....
The remote server returned an error: (500) Internal Server Error.
If the service is defined in the current solution, try building the solution and adding the service reference again.

The service reference is invalid. The .svcmap file ('C:\Projects_2010...') cannot be loaded. It may be corrupted or in a bad format: The service reference is invalid, because the .svcmap file.

此错误似乎会破坏我的localhost端口,因此我检查端口是否正在侦听cmd> netstat -anb。看起来这个端口正在使用此命令进行侦听。我收到的一些错误消息要求我删除并添加服务引用,所以我做了,我得到了一个更详细的错误消息,但它仍然没有帮助找到解决方案:

 Metadata contains a reference that cannot be resolved: 'http://localhost:57903/CreateServiceCall.xamlx'.
An error occurred while receiving the HTTP response to http://localhost:57903/CreateServiceCall.xamlx. 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.
The underlying connection was closed: An unexpected error occurred on a receive.
Unable to read data from the transport connection: An established connection was aborted by the software in your host machine.
An established connection was aborted by the software in your host machine
If the service is defined in the current solution, try building the solution and adding the service reference again.

自上次更新以来,此Web应用程序没有任何更改,因此我很困惑为什么此服务引用会突然失效。这是我的web.config服务器和绑定信息:

<system.serviceModel>
        <bindings>
   <basicHttpBinding>
    <binding name="BasicHttpBinding_IApplicationService" closeTimeout="00:01:00"
     openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
     allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
     maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
     textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
     messageEncoding="Text">
     <readerQuotas maxDepth="2000000" maxStringContentLength="2147483647" maxArrayLength="2147483647"
      maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
     <security mode="None">
      <transport clientCredentialType="None" proxyCredentialType="None"
       realm="" />
      <message clientCredentialType="UserName" algorithmSuite="Default" />
     </security>
    </binding>
    <binding name="BasicHttpBinding_IService" />
   </basicHttpBinding>
  </bindings>
        <client>
      <endpoint address="http://"actual_url"/CreateServiceCall.xamlx"
    binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IApplicationService"
    contract="Application.IApplicationService" name="BasicHttpBinding_IApplicationService" />
      <endpoint address="http://"actual_url"/CreateServiceCall.xamlx"
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
       contract="CreateServiceCall.IService" name="BasicHttpBinding_IService" />
      <!--<endpoint address="http://localhost:57903/CreateServiceCall.xamlx" 
   binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IApplicationService"
   contract="Application.IApplicationService" name="BasicHttpBinding_IApplicationService"  />
      <endpoint address="http://localhost:57903/CreateServiceCall.xamlx"
       binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
       contract="CreateServiceCall.IService" name="BasicHttpBinding_IService" />-->
  </client>
        <behaviors>
            <serviceBehaviors>
                <behavior>
                    <serviceMetadata httpGetEnabled="true"/>
                    <!--<sqlWorkflowInstanceStore connectionStringName="WF4Persistence" />-->
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>

Web应用程序设置为使用与web.config中相同的dev服务器。 我现在非常迷失为什么这个错误一直在讨厌。我甚至在TFS中回退了几个月到之前的版本并尝试在我的其他虚拟机上打开项目,但错误仍然存​​在。我将不胜感激任何帮助。 谢谢,

1 个答案:

答案 0 :(得分:0)

嗯,经过大量研究后,我不得不从一位经验更丰富的同事那里得到一些帮助。我们能够通过在此解决方案中创建另一个项目来解决错误。关于为什么项目之前工作正常然后突然出现问题仍然有点神秘,但这种变化似乎解决了这个问题。
据我所知,问题已经解决,因为我们摆脱了客户端绑定,并通过新项目的web.config使用服务器绑定。 xamlx文件的新位置使其可以作为新的服务引用添加,它似乎在最终确定时解决了错误。不确定这是否会对任何人有所帮助,但为了以防万一,我会把它留下来。 Picture of the solution and where we moved the projects