none
Add Web Reference error

    Question

  • Hi,

    I have my web service hosted on IIS7 in PC1 (Vista) w/c is already up and running. When I add my web service as a web reference on my sample client application in PC2 (Windows7), I encountered an error with details below

    Case 1:

        URL: http://192.168.1.1/MyService/

        "The HTML document does not contain Web service discovery information". There was an error downloading 'http://192.168.1.1/MyService/$metadata'. The request failed with HTTP status 404: Not Found."

    Case 2:

        URL: http://192.168.1.1/MyService/Service.svc

        "The document at the url http://10.11.2.108/TestWCF/Service.svc was not recognized as a known document type.
    The error message from each known type may help you fix the problem:
    - Report from 'DISCO Document' is 'There was an error downloading 'http://mypc/TestWCF/Service.svc?dis"

    the client app in PC2 can actually see the service but there's just some errors in the right pane of the "Add Web Service" window. Case2 URL return the page that I've expected but I noticed that it generates svcutil.exe http://mypc/TestWCF/Service.svc?wsdl w/c has the "PC NAME" and not the "IP ADDRESS" specified during the development.

     

    Thanks alot

    Wednesday, April 14, 2010 8:01 AM

Answers

  • Hi Atikero,

    As for the "webservice" you mentioend, I assume it is a WCF service that adopt HTTP binding. For service that you want to generate client proxy through add webreference or add serviceReference, you should make sure you have turn on service metadata generation:

    #How to: Publish Metadata for a Service Using a Configuration File
    http://msdn.microsoft.com/en-us/library/ms734765.aspx

    Then, for IIS hosted WCF service, you should always use the  http://servername/appname/servicename.svc?wsdl to get the metadata, you can use webbrowser to test it.

    As for the servername/ip address issue, it is an existing problem of the WCF runtime which originally always use the current internal servername to expose its endpoint address. There is a hotfix which can fix this issue so that the exposed endpoint address will use the address in the incoming request header:

    #FIX: URIs in a WCF WSDL document refer to inaccessible internal instances instead of to the load balancer as expected in the .NET Framework 3.0 in Windows Server 2003, Windows XP, Windows Vista and Windows Server 2008
    http://support.microsoft.com/kb/971842





    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, April 21, 2010 8:41 AM
    Moderator

All replies

  • Hi Atikero,

    As for the "webservice" you mentioend, I assume it is a WCF service that adopt HTTP binding. For service that you want to generate client proxy through add webreference or add serviceReference, you should make sure you have turn on service metadata generation:

    #How to: Publish Metadata for a Service Using a Configuration File
    http://msdn.microsoft.com/en-us/library/ms734765.aspx

    Then, for IIS hosted WCF service, you should always use the  http://servername/appname/servicename.svc?wsdl to get the metadata, you can use webbrowser to test it.

    As for the servername/ip address issue, it is an existing problem of the WCF runtime which originally always use the current internal servername to expose its endpoint address. There is a hotfix which can fix this issue so that the exposed endpoint address will use the address in the incoming request header:

    #FIX: URIs in a WCF WSDL document refer to inaccessible internal instances instead of to the load balancer as expected in the .NET Framework 3.0 in Windows Server 2003, Windows XP, Windows Vista and Windows Server 2008
    http://support.microsoft.com/kb/971842





    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Wednesday, April 21, 2010 8:41 AM
    Moderator
  • Hi Steven

    #FIX: URIs in a WCF WSDL document refer to inaccessible internal instances instead of to the load balancer as expected in the .NET Framework 3.0 in Windows Server 2003, Windows XP, Windows Vista and Windows Server 2008
    http://support.microsoft.com/kb/971842

    When I go to this Fix, I see

    Note that this fix applies only to Windows Vista/Windows Server 2008

    Can you please let me know if there is a fix for Windows Server 2003.

    Thanks

    Anil

    Monday, June 07, 2010 7:44 PM
  • Hi Steven,

    Thanks for the reply, after following your instruction, I managed to resolve the problem. Im sorry but Im new to WCF, my approach is just "research-trial&error"....ahahaha many thanks...

    Friday, August 27, 2010 3:26 AM