I\'m trying to host my service with IIS 6 but I keep get this exception.
Server Error in \'/WebServices\' Application.
----------------------------------
I had this problem - my service type was in the GAC. It WOULD work if i added the dll containing the type to the bin folder but as it was in the GAC this was NOT what I wanted. I eventually added this to the web.config for the service
<system.web>
<customErrors mode="RemoteOnly" />
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="[name in GAC], Version=[version in GAC], Culture=neutral, PublicKeyToken=[ac token]" />
</assemblies>
</compilation>
</system.web>
and it worked without needing any dlls in the bin folder.
This error occurs due to mismatch of Service name in .SVC file. Probably you might have changed the name of the service class that is implementing the interface.The Solution is to open .SVC file and exactly match the Service attribute and CodeBehind Attribute. So your .SVC file should be like
<%@ ServiceHost Language="Language you are using" Debug="bool value to enable debugging" Service="Service class name that is implementing your Service interface" Codebehind="~/Appcode/Class implementing interface.cs"%>. for eg.
<%@ ServiceHost Language="C#" Debug="true" Service="Product.Service" CodeBehind="~/AppCode/Product.Service.cs"%>
This example is for .svc file that is using C# language, with debugging enabled, Service class implementing interface and this class is within app folder with name Service.cs and Product is namespace for Service class.
Also Please make respective change in service config file.
<system.serviceModel>
<services>
<service name="Product.Service" behaviorConfiguration="ServiceBehavior">
<endpoint address="" binding="wsHttpBinding" contract="Product.Iservice">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<behavior name="ServiceBehavior">
<serviceMetaData httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</behaviors>
</system.serviceModel>
I practically solved the same issue . Here is my suggestion -- The error means that the object referenced in the Service attribute is not found. For the object to be found, the application or library must build output to the bin folder.
You can edit property page of the application and specify the output path to 'bin'.
I faced with this error today, reason was; IIS user doesn't have permission to reach to the application folder. I gave the read permissions to the app root folder.
I know this is probably the "obvious" answer, but it tripped me up for a bit. Make sure there's a dll for the project in the bin folder. When the service was published, the guy who published it deleted the dlls because he thought they were in the GAC. The one specifically for the project (QS.DialogManager.Communication.IISHost.RecipientService.dll, in this case) wasn't there.
Same error for a VERY different reason.
I had my service dll's in the bin folder where the svc file was residing. Moving the dll's to the root bin folder solved the problem.