gpt4 book ai didi

Azure 云服务中托管的 WCF 服务发布后出现错误

转载 作者:行者123 更新时间:2023-12-02 06:34:40 26 4
gpt4 key购买 nike

我有一个包含多个 WCF 服务(REST 和 SOAP 混合)的项目。该项目已在本地运行 6 个月,没有出现任何问题。我们正在将其转移到 Azure,但遇到了一个阻止我们上线的问题。

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

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

服务配置端点似乎存在问题。这是通过 Autofac WCF 集成使用 OOTB RouteTable 进行注册的:

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

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

最佳答案

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

我从 VS2013 进行发布,并在发布过程中标记了“启用 IntelliTrace”。一旦我取消了此选项并重新发布 - 一切正常......

关于Azure 云服务中托管的 WCF 服务发布后出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25268119/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com