开发者

I get a ServiceActivationException on one of my services while sometimes it works just fine

开发者 https://www.devze.com 2023-01-10 03:01 出处:网络
I have a service that retrieves data from a SQL server using Entity Framework. Most of the time it works fine but sometimes it fails with a

I have a service that retrieves data from a SQL server using Entity Framework. Most of the time it works fine but sometimes it fails with a

The requested service XXXXXXXXXXXXXXXXXXX could be activated." error. To be able to see whats wrong, I have enabled tracing and checked with svctraceviewer. And found out that there is a nullreference exception thats shown ... below are the details of the error I am seeing...

Exception Type: System.ServiceModel.ServiceActivationException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message: The service '/bookadventurewcf/CommonService.svc' cannot be activated due to an exception during compilation. The exception message is: Object reference not set to an instance of an object..

Stack Trace: System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath) System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest() System.ServiceModel.Activation.Ho开发者_如何学JAVAstedHttpRequestAsyncResult.BeginRequest() System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state) System.ServiceModel.Channels.IOThreadScheduler.CriticalHelper.WorkItem.Invoke2()

and so on

So its failing at EnsureServiceAvailable with an Object Refenence not set to an instance of an object.

I am not able to figure out whats causing the error.


I encountered this error for the reason mentioned below

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

So check the ram consumption of your server when more than 5% RAM is available your service would have worked fine and when not it throws this error

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号