0
votes

I am trying to add a reference to a web service for a new project in VS2012. I keep getting the below error:

There was an error downloading 'ServiceAddress/ConfigurationMgmt.wsdl/_vti_bin/ListData.svc/$metadata'. The request failed with HTTP status 400: Bad Request. Metadata contains a reference that cannot be resolved: 'ServiceAddress/ConfigurationMgmt.wsdl'. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'Basic realm="CASM"'. The remote server returned an error: (401) Unauthorized. If the service is defined in the current solution, try building the solution and adding the service reference again.

The part that more confusing is that I am able to add and use a reference to the same web service using VS2010. If I open the VS2010 project in VS2012 and try to update the service reference I get the same error.

I have tried adding the service reference to new projects in VS2012, starting VS2012 under admin mode and restarting my pc.

I have also tried adding references to other services in VS2012 project that are available on our intranet and they seem to work fine.

Is there something basic that I am missing here? What else can I try to find out the reason behind this problem?

2

2 Answers

1
votes

Change the web.config file in security tag,

<security mode="TransportCredentialOnly">
    <transport clientCredentialType="Anonymous"/>
    <message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>

i think this will hep you. if its not working then there is problem in your service provider deployment ACL

1
votes

I found that one possible reason that could be causing this was VS2012 trying to authenticate to the security proxy before it was allowed to get access to the wsdl.

To get around it, I started using the command line wsdl.exe tool to generate the web service data types. After that I did not have any more errors.

For .Net 4.0 it can be found at ""C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\wsdl.exe"

example of using it to auto generate types from a wsdl file:

wsdl /l:CS YourWebservice.wsdl /pu:username /pp:password /pd:yourFirmDomain.com Common.xsd xmlmime.xsd