Problem adding a reference in Visual Studio 2010 (from Web service URL on server)

Answered Problem adding a reference in Visual Studio 2010 (from Web service URL on server)

  • Friday, November 25, 2011 11:01 AM
     
     

    I have Visual Studio 2010 (using C#), and adding a reference from a web service on 2 servers (one local and one remote).

    When I enter the Service_name.svc file in 'Add Web Reference' from either server in VS i.e. http://IPAddress_Local_Server/App_name/Service_name.svc and http://IPAddress_Remote_Server/App_name/Service_name.svc.  When I do this from either server, I see the correct page appearing on that form i.e. the one that starts with 'You have created a service. To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:'.

    The problem is that on this form  (the ‘Add Web Reference’  form), on one of the servers it shows the correct ‘Web Reference found at this URL’, and I can click on the Add Reference button and it is added to VS.  However when I do this on the local server it shows the following message under ‘Web Reference found at this URL’, and the Add Reference button is greyed out.

    The document at the url httphttp://IPAddress_Local_Server/App_name/Service_name.svc was not recognized as a known document type.

    The error message from each known type may help you fix the problem:

    - Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=U …..

    I did a lot of reading about this, and tried various possibilities including svcutil (at http://social.msdn.microsoft.com/Forums/eu/wcf/thread/fb6d6c80-2edb-438b-a955-cd96918dd481), running aspregiis.exe –i, checking the .svc file in IIS, etc.  I also read that this problem may result from the order that things were installed like asp.net and WCF.

    I also have my own computer (Win 7 Home Premium) set up as a server, and while I can add a reference to the service name in VS from my own machine, if someone else tries to do this from another computer in our local network they get the ‘not recognized as a known document type’ message as above).

    So what is the most likely cause of this (permissions, IIS, etc), and possible solutions?


    Stephen

All Replies

  • Friday, November 25, 2011 3:30 PM
     
     Answered
    For anyone else with the same problem, we got the solution (at least solution to our Web Reference problem).  It was much simpler than thought.  The binding wasn't set properly under sites in IIS on the local server, but didn't even check this as everything else was working fine (apart from getting the web reference).
    Stephen
    • Marked As Answer by SWClarke Friday, November 25, 2011 3:30 PM
    •