Service Reference Error when trying to update or remove/add

柔情痞子 提交于 2019-12-13 04:46:40

问题


I have been searching for an answer to my service reference error for days now with no change. I made some changes to this web app a few months ago and I was able to update the service reference without any issue. Now, I made pretty much identical changes recently, but cannot update the service reference in the solution without an error: There was an error

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.

Or

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.

This error seems to refence my localhost port so I check to see if the port is listening with cmd > netstat -anb. It looks like this port is listening as it should with this command. Some of the error messages that I was getting asked me to remove and add the service reference, so I did and I got a error message with a little more detail but it still did not help find a solution:

 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.

No changes have been made to this web application since the last time it was update, so I am confused as to why this service reference would be invalid all of a sudden. Here is my web.config server and binding info:

<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>

The web app is set to use the same dev server as is in the web.config. I am very lost right now as to why this error keeps happing. I even rolled back many months to a previous version in TFS and tried opening the project on my other virtual machine, but the error still persists. I would appreciate any help. Thanks,


回答1:


Well, after much research I had to get some help from a much more experienced co-worker. We were able to solve the error by creating another project within this solution. It is still a bit of a mystery as to why the project worked fine before and then had issues suddenly, but this change seems to have solved the problem.
From what I understand, the issue was solved because we got rid of the client side bindings and use a server binding through the web.config of the new project instead. The new location for the xamlx file made it available to be added as a new service reference and it seemed to solve the error when finalizing. Not sure if this will help anyone, but I will leave it up just in case. Picture of the solution and where we moved the projects



来源:https://stackoverflow.com/questions/33173663/service-reference-error-when-trying-to-update-or-remove-add

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!