Create a Windows Communication Foundation Client
Hello,
According to http://msdn.microsoft.com/en-us/library/ms733133.aspx, I am going to use the command-line tool Service Model Metadata Utility Tool(SvcUtil.exe) with the appropriate switches to create the client code.
At step 5 I got the error below.
Code:
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin>svcutil.exe /language:vb /out:
generatedProxy.vb /config:app.config http://localhost:8080/ServiceSamples/servic
e
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Attempting to download metadata from 'http://localhost:8080/ServiceSamples/servi
ce' using WS-Metadata Exchange or DISCO.
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 3.0.4506.2152]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: Cannot obtain Metadata from http://localhost:8080/ServiceSamples/service
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:8080/ServiceSamples/service
Metadata contains a reference that cannot be resolved: 'http://localhost:808
0/ServiceSamples/service'.
There was no endpoint listening at http://localhost:8080/ServiceSamples/serv
ice that could accept the message. This is often caused by an incorrect address
or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (400) Bad Request.
HTTP GET Error
URI: http://localhost:8080/ServiceSamples/service
There was an error downloading 'http://localhost:8080/ServiceSamples/service
'.
The request failed with HTTP status 400: Bad Request.
If you would like more help, type "svcutil /?"
C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin>
Thanks for your help.
Re: Create a Windows Communication Foundation Client
I hope you have read my post in your last thread because I suspect it is the same cause here - your WCF server program needs to be running when you try to do this.
PS its easier to use the "Add Service Reference" option in Visual Studio instead of using svcutil - does the exact same thing.
Re: Create a Windows Communication Foundation Client
Could you look at here?
I posted it there and got some answers but having not found the final solution.
http://social.msdn.microsoft.com/For...-cc3812109306/
Re: Create a Windows Communication Foundation Client
How is the config file of your service?
Re: Create a Windows Communication Foundation Client
I dont think he is using a config file, just hosting it via the ServiceHost class. Or at least he was in a previous thread..
Re: Create a Windows Communication Foundation Client
The configuration file(Client.exe.config)
HTML Code:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_ICalculator" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8080/ServiceModelSamples/Service/CalculatorService"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICalculator"
contract="ICalculator" name="WSHttpBinding_ICalculator">
<identity>
<userPrincipalName value="HZHAO\hz" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
Re: Create a Windows Communication Foundation Client
Looks like, from the thread, that it was a case of not running the service. ;) Add resolved to the thread title.