Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

iis

wcf

I'm trying to host my service with IIS 6 but I keep get this exception.

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

The type 'QS.DialogManager.Communication.IISHost.RecipientService', 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 'QS.DialogManager.Communication.IISHost.RecipientService', 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 'QS.DialogManager.Communication.IISHost.RecipientService', provided as the Service attribute value in the ServiceHost directive could not be found.]
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +6714599
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +604
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +46
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +654

[ServiceActivationException: The service '/WebServices/dm/RecipientService.svc' cannot be activated due to an exception during compilation.  The exception message is: The type 'QS.DialogManager.Communication.IISHost.RecipientService', provided as the Service attribute value in the ServiceHost directive could not be found..]
   System.ServiceModel.AsyncResult.End(IAsyncResult result) +15626880
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15546921
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +227
   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.3082; ASP.NET Version:2.0.50727.3082 

I have absolutely no clue except that it seems like it can't find my assemblies. The code should be correctly compiled with public classes.

Here is my .svc file:

<%@ ServiceHost Language="C#" Debug="true" Service="QS.DialogManager.Communication.IISHost.RecipientService" CodeBehind="RecipientService.svc.cs" %>

I have tried to create a very very simple service that contains just nothin too see if this would work but still the same old error shows up.

The type 'IISHost.Service1', provided as the Service attribute value in the ServiceHost directive could not be found. 
like image 392
nandarya Avatar asked Apr 06 '09 09:04

nandarya


2 Answers

The problem could also be a in a different namespace in svc file as it is in svc.cs file.

In svc file namespace must be in the following format.

Service="Namespace.SvcClassName"
like image 89
Peter Stegnar Avatar answered Nov 01 '22 15:11

Peter Stegnar


Option One:

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.

Other Options:

  • WCF: The type provided as the Service attribute could not be found
  • The type , provided as the Service attribute value in the ServiceHost directive could not be found.
like image 67
Konstantin Tarkus Avatar answered Nov 01 '22 14:11

Konstantin Tarkus