繁体   English   中英

如何在IIS中注册Web服务?

[英]how to register a web service in iis?

我有一个用c#制作的Web服务,我想知道如何在IIS中注册它以便从另一个应用程序使用。 我知道如何从相同的解决方案中使用它,但是情况不一样。 搜索互联网时,我仅找到了如何注册应用程序。

Web服务的处理方式与IIS中的任何其他网站一样。 只需将站点转换为应用程序,然后选择适当的.Net框架版本。

设置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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM