Svcutil - July CTP - Metadata contains a reference that cannot be resolved

Hi,

I just wanted to try some sample code and generate the proxy with svcutil. The service is self hosted and I'm running into:

C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>SvcUtil.exe http://localhost:80
01/Weather/out:proxy.cs
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4312.0]
Copyright (c) Microsoft Corporation. All rights reserved.

Attempting to download metadata from 'http://localhost:8001/Weather/out:proxy.cs
' using WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4312.0]
Copyright (c) Microsoft Corporation. All rights reserved.

Error: Cannot obtain Metadata from http://localhost:8001/Weather/out:proxy.cs

If this is a Windows (R) Communication Foundation service to which you have acce
ss, please check that you have enabled metadata publishing at the specified addr
ess. For help enabling metadata publishing, please refer to the MSDN documentat
ion at http://go.microsoft.com/fwlink/ LinkId=65455.


WS-Metadata Exchange Error
URI: http://localhost:8001/Weather/out:proxy.cs

Metadata contains a reference that cannot be resolved: 'http://localhost:800
1/Weather/out:proxy.cs'.


< xml version="1.0" encoding="utf-16" >
<Fault xmlns="http://www.w3.org/2003/
05/soap-envelope">
<Code>
<Value>Sender</Value>
<Subcode>
<Value xmlns:a="http://sch
emas.xmlsoap.org/ws/2005/02/sc">a:BadContextToken</Value>
</Subcode>
</Code>
<Reaso
n="">
<Text xml:lang="de-DE">
The message could not be processed. This is most likely
because the action 'http://schemas.xmlsoap.org/ws/2004/09/transfer/Get' is inco
rrect or because the message contains an invalid or expired security context tok
en or because there is a mismatch between bindings. The security context token w
ould be invalid if the service aborted the channel due to inactivity. To prevent
the service from aborting idle sessions prematurely increase the Receive timeou
t on the service endpoint's binding.
</Text>
</Reason>
</Fault>


HTTP GET Error
URI: http://localhost:8001/Weather/out:proxy.cs

There was an error downloading 'http://localhost:8001/Weather/out:proxy.cs'.


The underlying connection was closed: An unexpected error occurred on a rece
ive.

Unable to read data from the transport connection: An existing connection wa
s forcibly closed by the remote host.

An existing connection was forcibly closed by the remote host

If you would like more help, type "svcutil / "

C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>


----------------------------------------

My config file looks like:

< xml version="1.0" encoding="utf-8" >
<configuration>
<system.serviceModel>
<services>
<service
name="Test.WeatherService">
<endpoint
address="http://localhost:8001/Weather/"
binding="wsHttpBinding"
bindingConfiguration="Binding1"
contract="Test.IWeather" />
</service>
</services>
<bindings>
<wsHttpBinding>
<!--
Following is the expanded configuration section for a WSHttpBinding.
Each property is configured with the default value.
See the ReliableSession, TransactionFlow, TransportSecurity, and MessageSecurity
samples in the WS directory to learn how to configure these features.
-->
<binding name="Binding1"
maxReceivedMessageSize="65536"
hostNameComparisonMode="StrongWildcard"
messageEncoding="Text"
textEncoding="utf-8"
bypassProxyOnLocal="false"
transactionFlow="false">

<reliableSession enabled="false"
ordered="true"
inactivityTimeout="00:10:00"/>
</binding>
</wsHttpBinding>
</bindings>
</system.serviceModel>
</configuration>


any ideas

Thanks,

Tom




Answer this question

Svcutil - July CTP - Metadata contains a reference that cannot be resolved

  • Tryin2Bgood

    I tried that before already after I did some research but that doesn't help. Still getting the same error

  • Samoyed

    sorry, typo.

    svcutil http://localhost:8001/Weather/ throws the original error again



  • Jeff Walsh

    Hi Tom,

    Code looks good, we have to query Meta data by using base address, since your base address and endpoint address is not same, we are not able to query Meta data by using endpoint address

    Please run following command to get Meta data

    svcutil http://localhost:8001/MultipleEndpoints/

    -Thank you

    Madhu



  • ponoy

    Hi ,

    This is ramesh.I am developing Indigo application very first time.

    I developed service and trying to generate .cs file inorder to use in client application by using svcutil.exe

    i am getting the following error.

    E:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>SvcUtil.exe http://localhost:81
    /servicemodelsamples/service /out:proxy.cs
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4324.13]
    Copyright (c) Microsoft Corporation. All rights reserved.

    Attempting to download metadata from 'http://localhost:81/servicemodelsamples/se
    rvice' using WS-Metadata Exchange or DISCO.
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4324.13]
    Copyright (c) Microsoft Corporation. All rights reserved.

    Error: Cannot obtain Metadata from http://localhost:81/servicemodelsamples/servi
    ce

    If this is a Windows (R) Communication Foundation service to which you have acce
    ss, please check that you have enabled metadata publishing at the specified addr
    ess. For help enabling metadata publishing, please refer to the MSDN documentat
    ion at http://go.microsoft.com/fwlink/ LinkId=65455.


    WS-Metadata Exchange Error
    URI: http://localhost:81/servicemodelsamples/service

    Metadata contains a reference that cannot be resolved: 'http://localhost:81/
    servicemodelsamples/service'.

    Could not connect to http://localhost:81/servicemodelsamples/service. TCP er
    ror code 10061: No connection could be made because the target machine actively
    refused it.

    Unable to connect to the remote server

    No connection could be made because the target machine actively refused it


    HTTP GET Error
    URI: http://localhost:81/servicemodelsamples/service

    There was an error downloading 'http://localhost:81/servicemodelsamples/serv
    ice'.

    Unable to connect to the remote server

    No connection could be made because the target machine actively refused it

    If you would like more help, type "svcutil / "

    Can you help me on this..............

    my config looking as........

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

    <configuration>

    <system.serviceModel>

    <services>

    <service name="Microsoft.ServiceModel.Samples.CalculatorService" behaviorConfiguration="Calbehaviourservice">

    <endpoint address="http://localhost:80/servicemodelsamples/service"

    binding = "basicHttpBinding"

    bindingConfiguration="BasicHttpBinding_CalculatorService"

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

    </service>

    </services>

    <behaviors>

    <serviceBehaviors>

    <behavior name="Calbehaviourservice"

    returnUnknownExceptionsAsFaults="True" >

    <serviceDebug includeExceptionDetailInFaults="True"/>

    <serviceMetadata httpGetEnabled="true" />

    </behavior>

    </serviceBehaviors>

    </behaviors>

    <bindings>

    <basicHttpBinding>

    <binding name="BasicHttpBinding_CalculatorService" maxReceivedMessageSize="2147483647"

    maxBufferSize="2147483647" maxBufferPoolSize="2147483647"

    hostNameComparisonMode="StrongWildcard"

    messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"

    bypassProxyOnLocal="true" useDefaultWebProxy="true"

    closeTimeout ="00:03:00" openTimeout ="00:03:00"

    sendTimeout="00:03:00" receiveTimeout ="00:03:00">

    <readerQuotas

    maxDepth="2147483647" maxStringContentLength="2147483647"

    maxArrayLength="2147483647" maxBytesPerRead="2147483647"

    maxNameTableCharCount="2147483647" />

    <security mode ="TransportCredentialOnly">

    <transport clientCredentialType="Windows"/>

    </security>

    </binding>

    </basicHttpBinding>

    </bindings>

    </system.serviceModel>

    </configuration>



  • noyesar

    Hi Sandeep,

    You just try this...


    SvcUtil.exe http://localhost:81/servicemodelsamples/service/ wsdl /out:proxy.cs

    It should help you.I am also new to this.But now i am some what ok with Indigo.

    Thanks,

    Ramesh.



  • scenedamaged

    I think the problem lies in the command line. You're missing a space before the /out:Proxy.cs argument. This made the URL to http://localhost:8001/Weather/out:proxy.cs, which is not what expected. Try this command line:

    SvcUtil.exe http://localhost:8001/Weather /out:proxy.cs



  • Josh_G

    Hello I am Sandeep

    i have also tried to implement a service , when i try to use the svcutil i too get the same error.

    i have used tcp instead of Http can u help me proceed with this as i am totally new to this

    Thanks in advance

    Regards

    Sandeep


  • pixelstuff

    Tom,

    Are you specifying a mex endpoint in your config The behavior Madhup suggested adding is needed, but you still need to create an endpoint for metadata exchange:

    <endpoint address="mex"

    binding="mexHttpBinding"

    contract="IMetadataExchange" />

    Try adding this and see if it fixes the problem.

    Michael Green - MSFT


  • Ramkumar Viswanathan

    your endpoint address is http://localhost:8001/Weather/

    you have to run following command,This will create code and config in current directory

    svcutil http://localhost:8001/Weather/

    if you want to give output directory,There should be space between endpoint address and output directory

    svcutil http://localhost:8001/Weather/  /out:c:\test.cs

     



  • gooon

    Hi,

    yes this was already solved by Madhu. I was looking at the book "Programming Indigo" which printed the command without a space. Thus, the confusion.

    Thanks,

    Tom

  • ChangNoi

    we have to add servceMetadata behavior to query meta data for svc,you can add IMetadataExchange endpoint also,can you please try this config

    http://blogs.thinktecture.com/cweyer/archive/2006/07/01/414630.aspx

    < xml version="1.0" encoding="utf-8" >
    <configuration>
    <system.serviceModel>
    <behaviors>
    <serviceBehaviors>
    <behavior name="NewBehavior">
    <serviceMetadata httpGetEnabled="true" />
    </behavior>

    </serviceBehaviors>
    </behaviors>
    <services>
    <service behaviorConfiguration="NewBehavior" name="Test.WeatherService">
    <endpoint address="http://localhost:8001/Weather/" binding="wsHttpBinding"
    bindingConfiguration="Binding1" contract="Test.IWeather" />
    </service>
    </services>
    <bindings>
    <wsHttpBinding>
    <!--
    Following is the expanded configuration section for a WSHttpBinding.
    Each property is configured with the default value.
    See the ReliableSession, TransactionFlow, TransportSecurity, and MessageSecurity
    samples in the WS directory to learn how to configure these features.
    -->
    <binding name="Binding1"
    maxReceivedMessageSize="65536"
    hostNameComparisonMode="StrongWildcard"
    messageEncoding="Text"
    textEncoding="utf-8"
    bypassProxyOnLocal="false"
    transactionFlow="false">

    <reliableSession enabled="false"
    ordered="true"
    inactivityTimeout="00:10:00"/>
    </binding>
    </wsHttpBinding>
    </bindings>
    </system.serviceModel>
    </configuration>



  • sllik

    port 8001 is not firewalled.

    running that command gives:

    C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin>SvcUtil.exe http://localhost:80
    01/out:proxy.cs
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4312.0]
    Copyright (c) Microsoft Corporation. All rights reserved.

    Attempting to download metadata from 'http://localhost:8001/out:proxy.cs' using
    WS-Metadata Exchange or DISCO.
    Microsoft (R) Service Model Metadata Tool
    [Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4312.0]
    Copyright (c) Microsoft Corporation. All rights reserved.

    Error: Cannot obtain Metadata from http://localhost:8001/out:proxy.cs

    If this is a Windows (R) Communication Foundation service to which you have acce
    ss, please check that you have enabled metadata publishing at the specified addr
    ess. For help enabling metadata publishing, please refer to the MSDN documentat
    ion at http://go.microsoft.com/fwlink/ LinkId=65455.


    WS-Metadata Exchange Error
    URI: http://localhost:8001/out:proxy.cs

    Metadata contains a reference that cannot be resolved: 'http://localhost:800
    1/out:proxy.cs'.

    There was no endpoint listening at http://localhost:8001/out:proxy.cs that c
    ould accept the message. This is often caused by an incorrect address or SOAP ac
    tion. See InnerException, if present, for more details.

    The remote server returned an error: (400) Bad Request.


    HTTP GET Error
    URI: http://localhost:8001/out:proxy.cs

    There was an error downloading 'http://localhost:8001/out:proxy.cs'.

    The request failed with HTTP status 400: Bad Request.

    If you would like more help, type "svcutil / "

    ... the sample is on it's way ...

  • redneon

    For sure,you need the config i sent you

    CHECK LIST:

    Are you able to browse http://localhost:8001/Weather/ from IE

    can you please add port 8001 to your windows firewall list

    can you please try following command(without many options)

    svcutil http://localhost:8001/Weather/

    if you still see the problem,please send me repro,I will try to repro here,my email id is madhup@microsoft.com

    -Thank you

    Madhu



  • Martin Kulov - MVP

    Hello Ramesh

    i tried to execute the above command. but still i am facing the same error.

    my base address specifies net.tcp

    i tried to provide the contract dll file and obtained the .xsd files and .wsdl file , then i tried to obtain client proxy by using svcutil for tcp , but i could not succeed.

    i ve tried an example using http which is workin fine , i am able to browse through the URL.

    but for tcp and to implement duplex contract i am absolutely stuck

    Current Scenario

    wht i have is

    --> One class library file with a Contract interface and a callback interface

    --> service which contains the implementation of the service with an app.config file specifying base address as

    net.tcp://localhost/Sandeep

    --> the host is up and working fine

    --> i need to obtain proxy.

    can u please suggest me the clear cut command for the above scenario

    Thanks for the help

    Regards

    Sandeep


  • Svcutil - July CTP - Metadata contains a reference that cannot be resolved