将WCF服务移动到Azure VM

时间:2013-10-13 10:02:42

标签: wcf iis azure azure-virtual-machine

我有一个在本地IIS中托管时运行良好的WCF服务服务,但在Azure VM IIS中托管时会出现以下异常:

DispatchOperation requires Invoker. 
Exception Details: System.InvalidOperationException: DispatchOperation requires Invoker

StackTrace:

[InvalidOperationException: DispatchOperation requires Invoker.]
   System.ServiceModel.Dispatcher.DispatchOperationRuntime..ctor(DispatchOperation operation, ImmutableDispatchRuntime parent) +17276262
   System.ServiceModel.Dispatcher.ImmutableDispatchRuntime..ctor(DispatchRuntime dispatch) +824
   System.ServiceModel.Dispatcher.DispatchRuntime.GetRuntimeCore() +114
   System.ServiceModel.Dispatcher.ChannelDispatcher.OnOpened() +520
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +766
   System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +260
   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +742
   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +126
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901

[ServiceActivationException: The service '/PidPlusService.svc' cannot be activated due to an exception during compilation.  The exception message is: DispatchOperation requires Invoker..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +650220
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210733
   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

我有svc文件,web.config文件和服务中的dll。服务项目是一个类库项目,是生成dll的解决方案的一部分。 是否需要在Azure中托管代码中更改某些内容?或者这是一个配置问题?

1 个答案:

答案 0 :(得分:0)

您必须配置虚拟机以支持WCF,就像您使用本地内部部署的IIS计算机一样。确保在Azure中的VM上配置了these settings

此外,您可能需要在Windows功能和WCF Http Activation'中启用。 (.NET Framework 3.5)。如果您的目标是.NET Framework 4.5,请确保' WCF服务' (.NET Framework 4.5高级服务)已启用。