I'm trying to implement tracing in my webservice, but I'm getting the error:
Couldn't find type for class Host.AzureLocalStorageTraceListener, MyProject.Host.
I've got a webservice which is hosted in azure but which doesn't follow the usual structure for azure webservices.
There is an azure project with a webrole which points to MyProject.Host. This is the start up project.
There is a project called MyProject.Host, which contains the web.config for the service and an azure webrole.
Then we have the MyProject.Service project, which contains the service interface, IService1, and the service code, Service1.cs.
The code in web.config is:
<sharedListeners>
<add name="AzureLocalStorage" type="Host.AzureLocalStorageTraceListener, MyProject.Host"/>
</sharedListeners>
And the error is:
Couldn't find type for class Host.AzureLocalStorageTraceListener, MyProject.Host. 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.Configuration.ConfigurationErrorsException: Couldn't find type for class Host.AzureLocalStorageTraceListener, MyProject.Host.
Source Error:
Line 53: private void RegisterRoutes()
Line 54: {
Line 55: RouteTable.Routes.Add(new ServiceRoute(string.Empty, new WebServiceHostFactory(), typeof(Service1)));
Line 56: }
Line 57: }
2 ideas I have have are that
because the role and the service are in 2 different places, it's getting confused about where the AzureLocalStorageTraceListener is, or
that because it hasn't been created by the usual Azure web service route that the AzureLocalStorageTraceListener hasn't been created.
But if it is these, I don't know how to fix them.
Does anyone have any ideas?
Thanks a lot!