Consuming a WCF Service

Posted by Lijo on Stack Overflow See other posts from Stack Overflow or by Lijo
Published on 2010-05-22T11:56:38Z Indexed on 2010/05/22 12:00 UTC
Read the original article Hit count: 200

Filed under:

Hi

I created a WCF service which is hosted in windows service. I created a proxy using svcutil “svcutil.exe http://localhost:8000/ServiceModelSamples/FreeServiceWorld?wsdl

It generated an output.config file and proxy class.

The output.config has the following element

<client>
            <endpoint address="http://localhost:8000/ServiceModelSamples/FreeServiceWorld"
                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IWeather"
                contract="IWeather" name="WSHttpBinding_IWeather">
                <identity>
                    <servicePrincipalName value="host/D471DTRV.ustr.com" />
                </identity>
            </endpoint>
 </client>

I created a website (as client) and added a new C# file (MyFile.cs) into it. I copied the contents of the proxy class into MyFile.cs. [The output.config is not copied to the web site]

In the code behnid of aspx, I am using the following code WeatherClient client= new WeatherClient("WSHttpBinding_IWeather");

It throws an exception as “Could not find endpoint element with name 'WSHttpBinding_IWeather' and contract 'IWeather' in the ServiceModel client configuration section.”

Could you please help me to understand the missing link here?

Thanks

Lijo

© Stack Overflow or respective owner

Related posts about wcfservice