Thursday, December 1, 2016

HttpContext.Current is null in Wcf Service

Issue:

HttpContext.Current is null in wcf service

Solution:

Set the aspNetCompatibilityEnabled is true in the Web.Config file

<system.serviceModel>
     <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
</system.serviceModel>

(Solved) Error: Memory gates checking failed because the free memory (203841536 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.

Error: 

Memory gates checking failed because the free memory (203841536 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.

Solution:

  • To resolve this, either reduce the load on the machine or adjust the value of minFreeMemoryPercentageToActivateService on the serviceHostingEnvironment config element.
<system.serviceModel>
    <serviceHostingEnvironment minFreeMemoryPercentageToActivateService="0" />
</system.serviceModel>

(Solved) Error: You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to 'C:\inetpub\wwwroot\...\Service.svc

Error:

You do not have permission to view this directory or page using the credentials you supplied (access denied due to Access Control Lists). Ask the Web server's administrator to give you access to 'C:\inetpub\wwwroot\...\Service.svc

Solution:

  • Give access permission to the "IUSR" in IIS. That should solved the problem.