简体   繁体   中英

Hosting Web Service in IIS - Not able to access the service

I have a WCF Service Application project in Visual Studio that contains the following files

  • ZooWebService.svc
  • WebConfig

I attempted to host the Web Service in IIS but when i browse to my web service from IIS the Web Service does not load at all. It just says "loading" in the browser.

Here is my WebConfig file:

 <?xml version="1.0"?>
    <configuration>
    <appSettings>
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
     </appSettings>
     <system.web>
    <compilation debug="false" targetFramework="4.6.1" />
    <httpRuntime targetFramework="4.6.1"/>
     </system.web>
      <system.serviceModel>
    <services>
      <service behaviorConfiguration="Default" 
     name="WCFWebService.ZooWCFService">
        <endpoint address="" binding="basicHttpBinding" 
     contract="WCFWebService.IZooWCFService" />
        <endpoint address="mex" binding="mexHttpBinding" 
        contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8080/" />
          </baseAddresses>
        </host>
        </service>
      </services>
       <behaviors>
      <endpointBehaviors>
        <behavior name="webBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
      <serviceBehaviors>
        <behavior name="Default">
          <serviceMetadata httpGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
         </serviceBehaviors>
       </behaviors>
     </system.serviceModel>
     </configuration>

I did the following so what have i done wrong?

  1. Open IIS
  2. Right clicked on Default Website
  3. Selected "Add Application"
  4. Populated "Alias" field
  5. Populated "Physical Path" to directory of where the solution contents are
  6. Clicked OK
  7. Rebuilt the solution in Visual Studio

For enabling the WCF in IIS, you may have to enable the HTTP activation feature for the .net framework first.

Some of links to do this https://docs.sdl.com/LiveContent/content/en-US/SDL%20Tridion%20full%20documentation-v1/GUID-326D6F7B-08EC-43EB-A5A7-9C51DD9E555C

https://pubs.vmware.com/mirage-56/index.jsp?topic=%2Fcom.vmware.mirage.api.pg.doc%2FGUID-552D845B-E530-4898-A06B-4F73E668BEFF.html

Once this is done you may try to deploy WCF directly from the visual studio to your local IIS>

Right click on the WCFproject -> go to properties -> in properties window -> select web tab -> in servers section select Local IIS and click on Create Virtual Directory.

Now run the WCF from Visual studio, this will host the WCF in local IIS.

样品

We don't need to specify the base address in the configuration file which needs to be set up in the web site binding module.
https://social.msdn.microsoft.com/Forums/vstudio/en-US/d42fc165-052d-476a-9580-1240b3d0293d/specify-endpoint-in-wcf-webconfig?forum=wcf
then we should enable the WCF feature in the IIS. 在此处输入图片说明
At last we could see the web service description in http://ip:port/xxxx.svc . 在此处输入图片说明 Feel free to let me know if there is anything I can help with.

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