You know as a beginner to learn WCF, the first thing is to make a simplest WCF service work like a classic "Hello World" console application. Now I will introduce the steps by following:

1.Create a "WCF Application Service" like this:
How to make a simplest WCF service work on Win7 with VS2010【转】

2. Rename the "IService1" to "ICalculatorService" and "Service1" to "CalculatorService" for both project file name and interface/class name in source code, and then update the generated code by default to following:
How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

3. Set as start page for "CalculatorService.svc" and then hit F5 to lauch the WCFServiceTestClient

How to make a simplest WCF service work on Win7 with VS2010【转】

4. Open IIS and "Sites->Add Website...", click OK button as below:

How to make a simplest WCF service work on Win7 with VS2010【转】

5. Right click the new added site and select "Add Virtual Directory...", after that, switch to "Content View" you can see below:
How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

6. Right click the new added virtual directory "Calculator" and then select "Convert to Application", click OK button

7. Right click the converted "Calculator" and then "Manage Applicataion->Browse"

8. If happen below error, need to change the Application Pool's .NET framework version to 4.0 as following:
How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

9. If happen below error, need to enable the "Directory Browsing" as the guided steps:

How to make a simplest WCF service work on Win7 with VS2010【转】

10. Repeat step7 and then click the link "CalculatorService.svc", if you can see the second picture, congratulations!

How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

11. If you are failed to see above picture, probably some ASP.NET components are not installed, so please first check if the 6 items are existing:

How to make a simplest WCF service work on Win7 with VS2010【转】

 

If not, please make sure below features are installed:
How to make a simplest WCF service work on Win7 with VS2010【转】How to make a simplest WCF service work on Win7 with VS2010【转】How to make a simplest WCF service work on Win7 with VS2010【转】How to make a simplest WCF service work on Win7 with VS2010【转】

12. Below is the optional steps, if above doesn't work:

Run cmd as administrator and then cd to "C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation", execute below commandline:

ServiceModelReg.exe -i

If above step generate any bad impact/result, I mean browse the created WCF service will happen some strange errors, we can rollback by executing below commandline:

ServiceModelReg.exe -u

13. Another optional step is(probably it doesn't need to do):

How to make a simplest WCF service work on Win7 with VS2010【转】

 

14. I believe the WCF service is published successfully be above several steps given, from then on, I will create a console applicaiton named "CalculatorClient" to consume the published WCF service.

 How to make a simplest WCF service work on Win7 with VS2010【转】

 

 14. Right click "References" and then select "Add Service Reference...",  input the WCF service address and then click "OK" button:

How to make a simplest WCF service work on Win7 with VS2010【转】

You know as a beginner to learn WCF, the first thing is to make a simplest WCF service work like a classic "Hello World" console application. Now I will introduce the steps by following:

1.Create a "WCF Application Service" like this:
How to make a simplest WCF service work on Win7 with VS2010【转】

2. Rename the "IService1" to "ICalculatorService" and "Service1" to "CalculatorService" for both project file name and interface/class name in source code, and then update the generated code by default to following:
How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

3. Set as start page for "CalculatorService.svc" and then hit F5 to lauch the WCFServiceTestClient

How to make a simplest WCF service work on Win7 with VS2010【转】

4. Open IIS and "Sites->Add Website...", click OK button as below:

How to make a simplest WCF service work on Win7 with VS2010【转】

5. Right click the new added site and select "Add Virtual Directory...", after that, switch to "Content View" you can see below:
How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

6. Right click the new added virtual directory "Calculator" and then select "Convert to Application", click OK button

7. Right click the converted "Calculator" and then "Manage Applicataion->Browse"

8. If happen below error, need to change the Application Pool's .NET framework version to 4.0 as following:
How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

9. If happen below error, need to enable the "Directory Browsing" as the guided steps:

How to make a simplest WCF service work on Win7 with VS2010【转】

10. Repeat step7 and then click the link "CalculatorService.svc", if you can see the second picture, congratulations!

How to make a simplest WCF service work on Win7 with VS2010【转】

How to make a simplest WCF service work on Win7 with VS2010【转】

11. If you are failed to see above picture, probably some ASP.NET components are not installed, so please first check if the 6 items are existing:

How to make a simplest WCF service work on Win7 with VS2010【转】

 

If not, please make sure below features are installed:
How to make a simplest WCF service work on Win7 with VS2010【转】How to make a simplest WCF service work on Win7 with VS2010【转】How to make a simplest WCF service work on Win7 with VS2010【转】How to make a simplest WCF service work on Win7 with VS2010【转】

12. Below is the optional steps, if above doesn't work:

Run cmd as administrator and then cd to "C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation", execute below commandline:

ServiceModelReg.exe -i

If above step generate any bad impact/result, I mean browse the created WCF service will happen some strange errors, we can rollback by executing below commandline:

ServiceModelReg.exe -u

13. Another optional step is(probably it doesn't need to do):

How to make a simplest WCF service work on Win7 with VS2010【转】

 

14. I believe the WCF service is published successfully be above several steps given, from then on, I will create a console applicaiton named "CalculatorClient" to consume the published WCF service.

 How to make a simplest WCF service work on Win7 with VS2010【转】

 

 14. Right click "References" and then select "Add Service Reference...",  input the WCF service address and then click "OK" button:

How to make a simplest WCF service work on Win7 with VS2010【转】

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-03
  • 2021-11-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-22
  • 2022-03-04
  • 2022-02-25
  • 2021-06-15
  • 2021-06-19
相关资源
相似解决方案