Roshan
Roshan

Reputation: 3384

How to resolve system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. Error in iis hosted wcf service ?

I have an issue when deploying wcf service to remote iis, first, I have vs solution contains two projects

  1. WCF Library (ExchangeMailCore)
  2. WCF Application(ExchangeMailService)

Inside my library project there is ExchangeEmailService.cs and ExchangeEmailService.cs files.

enter image description here

Then I included the library in ExchangeMailService project and created new .svc file as follows

<%@ServiceHost Language="C#" Debug="true" Service="ExchangeMailCore.ExchangeEmailService" %>

my web.config file as follows,

<?xml version="1.0"?>
<configuration>

  <appSettings>
    <!--<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />-->
    <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
  </appSettings>


  <system.web>

    <!--<compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5"/>-->
    <compilation debug="true" />
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
      <providers>
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
      </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
      <providers>
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
      </providers>
    </roleManager>
  </system.web>



  <system.serviceModel>

    <!--<bindings>
      <basicHttpBinding>
        <binding name="NetTcpBindingEndpointConfig">
          --><!--<security mode="Message" />--><!--
          <security mode="Transport">
            <transport clientCredentialType="Windows">
            </transport>
            --><!--<message clientCredentialType=""/>--><!--
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>-->


    <!--<services>
      <service name="ExchangeMailCore.ExchangeEmailService">
      </service>
    </services>-->

    <services>
      <service name="ExchangeMailCore.ExchangeEmailService">
        <endpoint address="" binding="basicHttpBinding"  contract="ExchangeMailCore.IExchangeEmailService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8734/Design_Time_Addresses/ExchangeMailCore/ExchangeEmailService/" />
          </baseAddresses>
        </host>
      </service>
    </services>


    <!--<behaviors>
      <serviceBehaviors>
        <behavior>
          --><!-- To avoid disclosing metadata information, set the values below to false before deployment --><!--
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="False"/>
          --><!-- 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="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>-->


    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, 
          set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="True" httpsGetEnabled="False" />
          <!-- 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>
    </behaviors>


    <!--<protocolMapping>
        <add binding="basicHttpBinding" scheme="http" />
    </protocolMapping>    

    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />-->

  </system.serviceModel>



  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <!--
        To browse web app root directory during debugging, set the value below to true.
        Set to false before deployment to avoid disclosing web app folder information.
      -->
    <directoryBrowse enabled="true"/>

  </system.webServer>

</configuration>

This runs perfectly on localhost, but when I deploy to the remote server it gives following error,

enter image description here

.Net framework is 4.5

Is any one can help on this?

Upvotes: 2

Views: 6350

Answers (1)

Roshan
Roshan

Reputation: 3384

After spending beautiful night, I found the solution, solution is adding the required library files(.dlls) to the deployed folder bin folder, I was using the EWS for email extraction so I have to add ews library to the bin folder of the published folder, thanks, hops this will help to someone.

Upvotes: 2

Related Questions