none
Collection already contains an address with scheme http RRS feed

  • Question

  •  

    My environment:

    Windows 2003 server that acts as a domain controller

    WCF service hosted in IIS


    Problem:

    Unable to connect to the wcf service from another machine on the same network (not joined to the domain).


    Was getting following error when adding Service Reference in VS 2008 or using the svcutil.exe:

     

    The document at the url http://192.168.2.50/wcfservice/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://machinename.domain.com/wcfservice/service.svc?disco'.'.

    - The remote name could not be resolved: 'machinename.domain.com'

    - Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

    - Report from 'http://192.168.2.50/wcfservice/service.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

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

    Metadata contains a reference that cannot be resolved: 'http://192.168.2.50/wcfservice/service.svc'.

    Content Type application/soap+xml; charset=utf-8 was not supported by service http://192.168.2.50/wcfservice/service.svc. The client and service bindings may be mismatched.

    The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..

    If the service is defined in the current solution, try building the solution and adding the service reference again.


    Ok, did some research on the problem. I went to Default Website props in IIS and added another identity for the website as follows: ip address = default, TCP port = 80, host header address = machinename.domain.com

    Browsed to the webservice directory and received following page:


    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:

    svcutil.exe http://machinename.domain.com/wcfservice/service.svc?wsdl

     

    Went back to VS2008 to add the Service Ref again and received the following error:


    This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.
    Parameter name: item


    Ok, did more research and applied the baseAddressPrefixFilters attribute in the web.config of the service with a prefix of http://machinename.domain.com, but I still cannot get it work, it keeps throwing the above error.

    What gives...I'm at the end of my rope with this. I'm tring to convert an existing WSE 3.0 service to a WCF service.


    Sample webconfig file for the test WCF service I'm using (it's one of the "Geting Started" project provided on MSND"):

    <?xml version="1.0" encoding="utf-8" ?>

    <configuration>

    <system.serviceModel>

    <serviceHostingEnvironment>

    <baseAddressPrefixFilters>

    <add prefix ="http://machinename.domain.com"/>

    </baseAddressPrefixFilters>

    </serviceHostingEnvironment>

    <services>

    <service

    name="Microsoft.ServiceModel.Samples.CalculatorService"

    behaviorConfiguration="CalculatorServiceBehavior">

    <!-- this endpoint is exposed at the base address provided by host: http://localhost/servicemodelsamples/service.svc -->

    <!-- specify BasicHttp binding and a binding configuration to use -->

    <endpoint address=""

    binding="basicHttpBinding"

    bindingConfiguration="Binding1"

    contract="Microsoft.ServiceModel.Samples.ICalculator" />

    </service>

    </services>


    <bindings>

    <!--

    Following is the expanded configuration section for a BasicHttpBinding.

    Each property is configured with the default value.

    See the TransportSecurity, and MessageSecurity samples in the

    Basic directory to learn how to configure these features.

    -->

    <basicHttpBinding>

    <binding name="Binding1"

    closeTimeout="00:01:00"

    openTimeout="00:01:00"

    receiveTimeout="00:10:00"

    sendTimeout="00:01:00"

    allowCookies="false"

    bypassProxyOnLocal="false"

    hostNameComparisonMode="StrongWildcard"

    maxBufferSize="65536"

    maxBufferPoolSize="524288"

    maxReceivedMessageSize="65536"

    messageEncoding="Text"

    textEncoding="utf-8"

    transferMode="Buffered"

    useDefaultWebProxy="true">

    <security mode="None" />

    </binding>

    </basicHttpBinding>

    </bindings>


    <!--For debugging purposes set the includeExceptionDetailInFaults attribute to true-->

    <behaviors>

    <serviceBehaviors>

    <behavior name="CalculatorServiceBehavior">

    <serviceMetadata httpGetEnabled="True"/>

    <serviceDebug includeExceptionDetailInFaults="True" />

    </behavior>

    </serviceBehaviors>

    </behaviors>


    </system.serviceModel>


    </configuration>




    Monday, August 4, 2008 8:01 PM

All replies