Monday 10 January 2011

WCF, Service attribute value in the ServiceHost directive could not be found.

I'm trying to host my service with IIS 7 but I keep get this exception.
Server Error in '/WebServices' Application.
--------------------------------------------------------------------------------

Server Error in '/' Application.
--------------------------------------------------------------------------------

The type 'PublicScheme.PublicScheme', provided as the Service attribute value in the ServiceHost directive 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 'MBPublicScheme.PublicScheme', provided as the Service attribute value in the ServiceHost directive 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 'PublicScheme.PublicScheme', provided as the Service attribute value in the ServiceHost directive could not be found.]
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +830
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +779
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +46
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +683

[ServiceActivationException: The service '/myservice/Default.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'MBPublicScheme.PublicScheme', provided as the Service attribute value in the ServiceHost directive could not be found..]
System.ServiceModel.AsyncResult.End(IAsyncResult result) +460
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +471
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +276
System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +220
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.4952; ASP.NET Version:2.0.50727.4955


Solution:

This message is often due to an IIS 7 config problem. If you are used to creating a virtual directory pointing to the folder where your service resides, that no longer works. Now, you need to use the "Create Application..." option instead.

No comments:

Post a Comment