Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Activate WCF service

Tags:

wcf

I'm working over WCF and it worked fine on localhost. After I placed it on the production server, it thows an exception

The requested service, 'http://global-kazway.kz/Service1.svc' could not be activated. See the server's diagnostic trace logs for more information

I'm new in Services and have been trying to solve this problem for almost 3 hours.

Here is the App.config of the client;

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <configSections></configSections>
  <connectionStrings>
    <add name="TestProject.Properties.Settings.DBConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\1\Documents\visual studio 2010\Projects\TestProject\TestProject\AppData\DB.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" /><add name="DBEntities" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=C:\Users\1\Documents\visual studio 2010\Projects\TestProject\TestProject\AppData\DB.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /><add name="DBEntities1" connectionString="metadata=res://*/DBModel.csdl|res://*/DBModel.ssdl|res://*/DBModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=.\SQLEXPRESS;attachdbfilename=|DataDirectory|\AppData\DB.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" /></connectionStrings>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IService1" closeTimeout="00:01:00"
          openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
          allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
          messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
          useDefaultWebProxy="true">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="None">
            <transport clientCredentialType="None" proxyCredentialType="None"
              realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://global-kazway.kz/Service1.svc" binding="basicHttpBinding"
        bindingConfiguration="BasicHttpBinding_IService1" contract="kazwayServiceReference.IService1"
        name="BasicHttpBinding_IService1" />
    </client>
  </system.serviceModel>
</configuration>
like image 603
Nate Avatar asked Jun 05 '12 18:06

Nate


People also ask

How do I find the server's diagnostic trace log?

Supported configurations: You can only access this page when the server is configured to use basic log and trace mode. To view this administrative console page, click Troubleshooting > Logs and trace > server_name > Diagnostic trace. Note: This topic references one or more of the application server log files.

What is Windows Communications Foundation HTTP Activation?

Windows Communication Foundation (WCF) is a framework for building service-oriented applications. Using WCF, you can send data as asynchronous messages from one service endpoint to another. A service endpoint can be part of a continuously available service hosted by IIS, or it can be a service hosted in an application.


2 Answers

First step in troubleshooting a WCF application is to bring up a browser and type in the service URI. So based on the client: you'd navigate to http://global-kazway.kz/Service1.svc

Now see what kind of results you get. Exception? The service screen? Usually you can get your best information from this screen! Sometimes it points out what your issue is such as missing a behavior.

Compare your web.config with the deployed web.config entries. You may find something there as well. Finally you may just have to manage security on your folder. But the browser display could spell everything out for you very clearly.

like image 60
SASS_Shooter Avatar answered Nov 12 '22 15:11

SASS_Shooter


I'm working on a project and I faced the same problem. When I checked the Event Viewer to trace the error, I found where the problem was.

Event Viewer message:

Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/7540993
 Exception: System.ServiceModel.ServiceActivationException: The service '/CODWebService/Service1.svc' cannot be activated due to an exception during compilation.  The exception message is: Memory gates checking failed because the free memory (164065280 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.. ---> System.InsufficientMemoryException: Memory gates checking failed because the free memory (164065280 bytes) is less than 5% of total memory.  As a result, the service will not be available for incoming requests.  To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.

Then I added the below code to my service's web.config file.

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" minFreeMemoryPercentageToActivateService="1" />

This element should be placed in <system.serviceModel>

like image 41
Ali Shokrollahi Avatar answered Nov 12 '22 17:11

Ali Shokrollahi