Click here to Skip to main content
15,886,091 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hai,

Iam developing a wcf application for IIS 5/6 hosting.I create a project WCFService3 in the file location "C:\Documents and Settings\sridharan\My Documents\Visual Studio 2008\WebSites\WCFService3".After creating a website I declare the service contract in IService.cs with the following syntax.
string helloworld(string name);


In the Service.cs I write the the code
public string HelloWorld(string name)
    {
        return "Hello " + name;
    }


After running the above wcf application I Get the window "you have created a service" with the following line.

"svcutil.exe http://localhost:1137/WCFService3/Service.svc?wsdl".

My doubt is in web.config file whether i have to put the end point address is
"svcutil.exe http://localhost:1137/WCFService3/Service.svc?wsdl".

(or)

"C:\Documents and Settings\sridharan\My Documents\Visual Studio 2008\WebSites\WCFService3".

In command prompt if i write "svcutil.exe http://localhost:1137/WCFService3/Service.svc?wsdl". the error is occurs.

"svcutil is not recognised".
please clear my doubt.My question is too length :)
Posted

1 solution

To host a service in IIS you need to create a file with extension .svc and add following lines in it

XML
<%@ServiceHost Service="WCFService3.Service"%>


and following to your web.config with in System.ServiceModel tag
XML
<services>
     <service name="WCFService3.Service">
       <!-- Service Endpoints -->
       <endpoint address="" binding="wsHttpBinding" contract="WCFService3.IService">
         </endpoint>
       <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
     </service>
   </services>

then create a client and add reference to this service from visual studio and this will automatically create endpoint for your client.

--Pankaj
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900