问题
I am trying to add service reference.
There was an error downloading metadata from the address
this is the error which is being displayed again and again?
Please help
回答1:
There are atleast 4 possibilities:
- The metadata exchange mex endpoint is not defined
- metadata exchange is not enabled
- You are using the wrong address
- You are being blocked by some security setting
Try the url in a browser to see that it returns a wsdl
回答2:
You may also just need to build / rebuild the project.
回答3:
It was happening the same to me and I found that I've had forgotten to add the "Service Contract" and the "Operation Contract" annotations on the interface of my WCF service
回答4:
Just try to Build the project without any error and give service reference again.
回答5:
In Web.config file I changed :
<endpoint address="" binding="pollingDuplexHttpBinding"
contract="IAsyncTaskService"/>
to this :
<endpoint address="" binding="pollingDuplexHttpBinding"
contract="DuplexService.Web.IAsyncTaskService"/>
and error was removed. Zeni
回答6:
Try rebuilding the project first, if that does not fix it, try changing the property httpGetEnabled from FALSE to TRUE in your web.config.
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
回答7:
Another possibility in this situation is that there is no endpoint listening. I.e., the service you are trying to add isn't "up". I made this mistake when trying to add a reference to a WCF service I was working on, but I forgot to Open it.
回答8:
Check IIS is serving the service URL. In my case, I had changed my Windows password, but had forgotten that these credentials were being used by IIS in both the application and the app pool.
回答9:
I had an issue like this one : Adding a service reference failed with a message "Method not allowed".
The wsdl worked fine in my browser..
The reason was that I configured the endpoint to listen on http://0.0.0.0:6000/mex
, which the "Add Service Reference" tool doesn't seem to like. Changing it to a real IP address made it work (e.g. http://127.0.0.1:6000/mex
)
回答10:
I know this is an oldie, but I thought I would add what worked for me so that I can find it again down the road ;)
In my case, the AppPool user didn't have access the %Windir%\temp, which apparently is necessary in order for the MEX data to be generated.
Shout out to Amy Peng in this thread for her tip!
来源:https://stackoverflow.com/questions/10618181/there-was-an-error-downloading-metadata-from-the-address