0

I have created this service: http://www.c-sharpcorner.com/UploadFile/dhananjaycoder/four-steps-to-create-first-wcf-service-for-beginners/ and now I want to host that service on IIS.

The solutions I came across are creating service library and then creating a separate hosting project.

What if I want to host WCF service application on IIS?

Purpose of hosting on IIS is because I want to consume that service on android application.

halfer
  • 19,824
  • 17
  • 99
  • 186
DharaPPatel
  • 12,035
  • 9
  • 31
  • 49
  • In the new projects window, select WCF Service Application. That will create an IIS-based WCF service for you. – Tim Dec 19 '13 at 06:09

1 Answers1

1

MSND How-to for hosting the WCF on IIS. You don't have to create Service library seperatly and hosting application seperately. All you can do is create a simple Visual studio WCF Service Application Project which includes a SVC file which will help you to host on IIS and create Services in the same project. Steps:

  1. Create a new Visual Studio WCF Service Application
  2. This WCF Service Project already contains the SVC file, which is used for hosting the services on IIS.
  3. Create your services.
  4. Compile the Service Project.
  5. Open the IIS using inetmgr windows shortcut (win + r)
  6. Create a website /web application on IIS and point the WCF Service Application Project directly.
  7. Select Appropriate Application Pool, depending on your .NET Framework.
Bhalchandra K
  • 2,631
  • 3
  • 31
  • 43
  • any step by step guide ? Simple Visual Studio New WCF service application except the original one ? – DharaPPatel Dec 19 '13 at 06:14
  • i am still confused that should i create new project for hosting existing WCF application or in the same project i need to add SVC file ? – DharaPPatel Dec 19 '13 at 06:24
  • If you have not gone far, meaning not have not much implementation. Better start with a new Visual Studio Project. Even if you have created few Service Interfaces, you can easily copy paste it in new WCF Service Application. – Bhalchandra K Dec 19 '13 at 06:33
  • i did it as per above instructions , i am able to browse service from inetmgr and it gives me url :http://localhost/WCFCalc/Calculator.svc , now for checking methods and test it , i installed WCF Test Client and inserting same url to test but its giving me an error.. – DharaPPatel Dec 19 '13 at 06:57
  • It should work, Can you try creating a another project(either web/win/console). Add Web Service reference to Your Service and test it. – Bhalchandra K Dec 19 '13 at 07:03
  • i did it that also..i add service reference :http://localhost/WCFCalc/Calculator.svc?wsdl and it says "an error occurred while attempting to find service at 'http://localhost/WCFCalc/Calculator.svc?wsdl' – DharaPPatel Dec 19 '13 at 07:34
  • Please check if Calculator.SVC file has valid Server Interface set for the 'Service' attribute like below: <%@ServiceHost language=c# Debug="true" Service="Microsoft.ServiceModel.Samples.CalculatorService"%> – Bhalchandra K Dec 19 '13 at 07:46