发布后,Azure Cloud Service中的WCF服务托管错误

时间:2014-08-12 15:19:49

标签: wcf iis azure

我有一个包含多个WCF服务的项目(REST和SOAP的混合)。该项目已经运行On-Prem 6个月没有问题。我们正在将此移至Azure,但遇到了一个阻止我们上线的问题。

该项目使用Autofac作为其IOC。我们很高兴在Azure的Cloud Service中托管这个。在Azure模拟器中本地运行时,一切似乎都能正常工作,但是一旦我们使用Cloud Service项目进行部署,所有内容都会正确构建和部署,但在尝试访问服务时会收到以下错误。

Server Error in '/' Application.


Value cannot be null. Parameter name: key

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.ArgumentNullException: Value cannot be null. Parameter name: key 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:

[ArgumentNullException: Value cannot be null.

Parameter name: key]

   System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument) +48

   System.Collections.Generic.Dictionary`2.FindEntry(TKey key) +38

   System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value) +20

   System.ServiceModel.Dispatcher.WebHttpDispatchOperationSelector..ctor(ServiceEndpoint endpoint) +2459

   System.ServiceModel.Description.WebHttpBehavior.GetOperationSelector(ServiceEndpoint endpoint) +125

   System.ServiceModel.Description.WebHttpBehavior.ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher) +1955

   System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +4245

   System.ServiceModel.ServiceHostBase.InitializeRuntime() +119

   System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +45

   System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +553

   System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +350

   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1614

[ServiceActivationException: The service '/Event/Calendar' cannot be activated due to an exception during compilation.  The exception message is: Value cannot be null.

Parameter name: key.]

   System.Runtime.AsyncResult.End(IAsyncResult result) +925

   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +528

   System.ServiceModel.Activation.AspNetRouteServiceHttpHandler.EndProcessRequest(IAsyncResult result) +107

   System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +151

它似乎遇到了服务配置端点的问题。这是使用OOTB RouteTable通过Autofac WCF集成注册的:

RouteTable.Routes.Add(new ServiceRoute("Event/Calendar", new AutofacWebServiceHostFactory(), typeof(CalendarSvc)));

所有这些在IIS和本地Azure模拟器中都可以正常工作,但是一旦部署到云服务就会出现问题。

1 个答案:

答案 0 :(得分:3)

观察到确切的问题。通过取消此托管服务上的IntelliTrace解决此问题。

我从VS2013发布并标记为"启用IntelliTrace"在出版期间。一旦我取消了这个选项并重新发布 - 一切正常......