问题
I have built a WCF Data Service that works when I run it on my development machine, but when I move it to a Windows 2008 VM running on Azure, I get the following error when I attempt to navigate to the .svc URL:
Request Error
The server encountered an error processing the request. The exception message is 'The type initializer for 'System.Data.Services.Providers.ResourceType' threw an exception.'. See server logs for more details. The exception stack trace is:at System.Data.Services.Providers.ResourceType.get_PrimitiveResourceTypeMap() at System.Data.Services.Providers.ObjectContextServiceProvider.PopulateMetadata(IDictionary
2 knownTypes, IDictionary
2 childTypes, IDictionary2 entitySets) at System.Data.Services.Providers.BaseServiceProvider.LoadMetadata() at System.Data.Services.DataService
1.CreateMetadataAndQueryProviders(IDataServiceMetadataProvider& metadataProviderInstance, IDataServiceQueryProvider& queryProviderInstance, BaseServiceProvider& builtInProvider, Object& dataSourceInstance) at System.Data.Services.DataService1.CreateProvider() at System.Data.Services.DataService
1.HandleRequest() at System.Data.Services.DataService`1.ProcessRequestForMessage(Stream messageBody) at SyncInvokeProcessRequestForMessage(Object , Object[] , Object[] ) at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs) at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc) at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc) at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
I deployed by creating a web application under the default website on the server and copying my files directly into the folder. The .aspx pages in the same location work as expected.
I found this post, which suggests it is a problem with not having the proper DLL files on the server. My bin folder contains the following DLLs in addition to the ones specific to my service, but it still does not work:
EntityFramework.dll 5.0.0.net40
Microsoft.Data.Edm.dll 5.0.0.50808
Microsoft.Data.OData.dll 5.0.0.50808
Microsoft.Data.Services.Client.dll 5.0.0.50808
Microsoft.Data.Services.dll 5.0.0.50808
System.Spatial.dll 5.0.2.50815
I've exhausted my limited knowledge and what I consider pretty good search ability, so if anyone can steer me in the right direct, it would be appreciated.
Thanks!
回答1:
Why do you have a different version for System.Spatial? Please make sure the version of System.Spatial is also 5.0.0.50808. That should fix the problem.
Basically, all the assemblies should be of the same version.
来源:https://stackoverflow.com/questions/13568023/wcf-data-service-deployment-issues