简体   繁体   中英

Host Website in IIS having WCF Service

I have a website which contains one WCF service. I dont have separate WCF Project for that. when working locally it works fine. Now I want to host that website in IIS It is showing 404 (Not Found)

http://arapl-ws-08/ARAPLWeb/wcf/ExposureService.svc/InitializeGrid 404 (Not Found)

this is the folder structure after hosting website 在此处输入图片说明

in web.config I have mentioned service model like this

<system.serviceModel>
    <bindings>
      <webHttpBinding>
        <binding name="WebHttpEndpointBinding">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Windows" proxyCredentialType="Windows" />
            <!--<transport clientCredentialType="Windows"  />-->
          </security>
        </binding>
      </webHttpBinding>
    </bindings>

    <behaviors>
      <endpointBehaviors>
        <behavior name="ARAPL">
          <endpointDiscovery enabled="false" />
          <enableWebScript />
        </behavior>
      </endpointBehaviors>

      <serviceBehaviors>
        <behavior name="WCFWindowsBasicHttpBinding.Service1Behavior">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
          <serviceAuthenticationManager authenticationSchemes="Negotiate" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>

      <service name="RiskAnalytics.Web.wcf.ExposureService" behaviorConfiguration="WCFWindowsBasicHttpBinding.Service1Behavior">
        <endpoint address="" name="webHttpEndpoint" binding="webHttpBinding" bindingConfiguration="WebHttpEndpointBinding" behaviorConfiguration="ARAPL" contract="RiskAnalytics.Web.wcf.IExposureService">
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

    </services>
  </system.serviceModel>

this solved my problem. In fusture if anyone got an issue refer this

I found these instructions on a blog post that indicated this step, which worked for me (Windows 8, 64-bit):

Make sure that in windows features, you have both WCF options under .Net framework are ticked.

So go to Control Panel –> Programs and Features –> Turn Windows Features ON/Off –> Features –> Add Features –> .NET Framework XX Features. Make sure that .Net framework says it is installed, and make sure that the WCF Activation node underneath it is selected (checkbox ticked) and both options under WCF Activation are also checked.

These are:

* HTTP Activation
* Non-HTTP Activation

Both options need to be selected (checked box ticked).

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