如何在iis中注册Web服务?

时间:2011-11-27 17:20:24

标签: c# web-services iis

我有一个用c#制作的网络服务,我想知道如何在IIS中注册它以供其他应用程序使用。我知道如何从同一个解决方案中使用它,但这不是同一个案例。搜索互联网,我只找到了如何注册应用程序。

2 个答案:

答案 0 :(得分:1)

Web服务与IIS中的任何其他网站一样对待。只需将站点转换为应用程序并选择适当的.Net框架版本。

答案 1 :(得分:0)

在为Web服务设置网站后,您需要在web.config中进行一些设置。我想你可能会想念他们

将服务添加到web.config,如下所示

<services>
  <service name="RestService.RestServiceImpl" behaviorConfiguration="ServiceBehaviour">
    <endpoint address="" binding="webHttpBinding" contract="RestService.IRestServiceImpl" behaviorConfiguration="web">         
    </endpoint>
  </service>
</services>

还添加服务行为和端点行为

<serviceBehaviors>
    <behavior name="ServiceBehaviour">
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="true"/>
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="false"/>
    </behavior>
</serviceBehaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp/>
    </behavior>
  </endpointBehaviors>
相关问题