简体   繁体   中英

how to register a web service in iis?

I have a web service made in c# and I want to know how to register it in IIS for consumption from another app. I know how to consume it from the same solution but this isn't the same case. Searching the internet, I've only found how to register an app.

A web service is treated like any other website in IIS. Simply convert the site to an application and pick the appropriate .Net framework version.

After you have setup the website for web service you need to do some setting in your web.config. I guess you might be missing them

Add service to the web.config like following

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

Also add service behaviour and endpoint behaviour

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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