11921

WCF Web Service not working after IIS restart

Question:

I have a web service running on IIS 7.5

Whenever I restart the IIS or the AppPool of the website this web service is running I am getting the error message below. Then I found out that, if I change the complilation version (either from 4.5 to 4.0 or if it is 4.0 to 4.5) and save the web.config file then it starts working regularly. This is really weird. Can anybody help me on this please.

web.config:

<configuration> <system.web> <compilation debug="true" targetFramework="4.5"/> <httpRuntime targetFramework="4.5"/> </system.web> <connectionStrings> <add name="NetDBEntities" connectionString="metadata=res://*/EFatura.csdl|res://*/EFatura.ssdl|res://*/EFatura.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=***********;initial catalog=*****;persist security info=True;user id=sa;password=***************;MultipleActiveResultSets=True;App=NSEfatLib&quot;" providerName="System.Data.EntityClient" /> </connectionStrings> <system.serviceModel> <services> <service name="NSEfatLib.NSEfatEntryPoint"> <endpoint address="Cari" binding="basicHttpBinding" bindingConfiguration="" name="Cari" contract="NSEfatLib.ICari" /> <endpoint address="Stok" binding="basicHttpBinding" bindingConfiguration="" name="Stok" contract="NSEfatLib.IStok" /> <endpoint address="FaturaIslemler" binding="basicHttpBinding" bindingConfiguration="" name="FaturaIslemler" contract="NSEfatLib.IFaturaIslemler" /> <endpoint address="DefterIslemler" binding="basicHttpBinding" bindingConfiguration="" name="DefterIslemler" contract="NSEfatLib.IDefterIslemler" /> </service> </services> <behaviors> <serviceBehaviors> <behavior> <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true"/> </behavior> </serviceBehaviors> </behaviors> <protocolMapping> <add binding="basicHttpsBinding" scheme="https"/> </protocolMapping> <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <directoryBrowse enabled="true"/> </system.webServer> </configuration>

Error Message:

<blockquote>

The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]<br /> System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +122516<br /> System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1451<br /> System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +76<br /> System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901

[ServiceActivationException: The service '/Service.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..] System.Runtime.AsyncResult.End(IAsyncResult result) +650220 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210733<br /> System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

</blockquote>

Event Log Entry:

<blockquote>

System.ServiceModel.ServiceHostingEnvironment+HostingManager/62476613 System.ServiceModel.ServiceActivationException: The service '/Service.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.. ---> System.InvalidOperationException: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) --- End of inner exception stack trace --- at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity) w3wp<br /> 5028

</blockquote>

Answer1:

Interestingly above error was fired when the web service was precompiled. I tried the service to run regularly (without precomopiling) and the issue is not appearing anymore.

I was using a library within the web service, so practically the web service itself did not have any code at all. Maybe that is the reason. Anyways, as there is no code, no precompilation is fine too.

Recommend

  • Connection String Is not Working Object instance reference is null
  • Does Godaddy support database connections to App_Data mdf databases?
  • How connect to SQL Server Compact 4.0 in ASP.NET?
  • Filter expression in Sqldatasouce
  • PostgreSQL via subsonic
  • Azure error - connection string difficulties
  • Proper format for SQL Server Connection String on 1and1.com
  • Sql Connection String to named instance
  • How to give connection string as a key value?
  • refused my local machine sql connection for 1433 port
  • Connect data in two classes for use in a View
  • MVC Getting Error - CREATE DATABASE permission denied
  • How to deploy C# windows application (setup file) with database and how to manage connection string
  • SQL CE 3.5 & EntityFramework
  • Server specific Web.config replacement
  • How to deploy or publish Windows app with SQL Server database
  • ERROR: Unknown connection option in connection string: attachdbfilename
  • ASP.Net MVC 3 Configuration
  • Encoding=ASCII; and Encoding=UNICODE; do not work in an Npgsql 3 connection string
  • Connection string between IIS and SQL server
  • Exception: System.ArgumentException: Keyword not supported: 'initial catalog' when hard co
  • Boostraping symfony 2 for pthread from command
  • What is wrong with this mysql connection string?
  • Rectangular Nesting - Convergence to optimal solution using Simulated Annealing
  • handling sigterm in OSx
  • Grails error: table or view does not exist
  • dbus Variant: How to preserve boolean datatype in Python?
  • Unix Network Programming Clarification
  • MYSQ & MVC3 SQL connection error \\ ProviderManifestToken but I am using MySQL
  • Authentication in Play! and RestEasy
  • MongoError: Incorrect arguments
  • Django rest serializer Breaks when data exists
  • Exception “firebase.functions() takes … no argument …” when specifying a region for a Cloud Function
  • Is calc() supported in html email?
  • req.body is undefined - nodejs
  • Symfony2: How to get request parameter
  • Akka Routing: Reply's send to router ends up as dead letters
  • Is there a mandatory requirement to switch app.yaml?
  • Authorize attributes not working in MVC 4
  • UserPrincipal.Current returns apppool on IIS