技术开发 频道

详解在IIS中配置并运行WCF服务

  验证新的IIS应用程序

  8. 在IIS Manager窗口中,右键单击DerivativesCalculator节点并选择Switch to Content View菜单项,如图所示。


从IIS View切换到Content View

  9. IIS Manager的右边现在应该显示出DerivativesCalculatorService的内容,如图所示。


Content View

  10. 关闭IIS Manager。

  ·配置服务

  1. 回到Visual Studio,在Solution Explorer中右键单击DerivativesCalculatorService项目并选择Add | New Item菜单项。

  2. 在Add New Item对话框的Categories列表中选择General。在Templates部分选择Application Configuration File模板。

  3. 将文件命名为Web.Config并单击Add按钮。

  4. 在Solution Explorer中选择刚添加的Web.config文件,在Properties窗口中将Copy to Output属性设为Copy always。

  5. 用下面的XML代码替换掉Web.config文件中的内容。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
<system.serviceModel>
    
<services>
      
<service name="DerivativesCalculatorService.Calculator">
        
<endpoint
                    
address=""
                    binding
="basicHttpBinding"
                    contract
="DerivativesCalculatorService.IDerivativesCalculator"/>
      
</service>
    
</services>
  
</system.serviceModel>
</configuration>

   6. 选择File | Save All菜单项。

  7. 选择Build | Build Solution菜单项。

0
相关文章