我遇到了一个我们没有设计的应用程序的问题。我不是开发者,供应商只是帮助。
启动站点并单击应显示列表的下拉框时,此事件将记录在IIS服务器上:
WebHost无法处理请求。 发件人信息:System.ServiceModel.ServiceHostingEnvironment + HostingManager / 23324256 异常:System.ServiceModel.ServiceActivationException:由于编译期间发生异常,无法激活服务'/API/JsonFetcher.svc'。异常消息是:从“SpectrumHR.API.JsonFetcher”类型的CreateServiceHost方法返回的ServiceHostBase对象为null .. ---> System.InvalidOperationException:从“SpectrumHR.API.JsonFetcher”类型的CreateServiceHost方法返回的ServiceHostBase对象为null。 在System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath,EventTraceActivity eventTraceActivity) 在System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo,EventTraceActivity eventTraceActivity) 在System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath,EventTraceActivity eventTraceActivity) ---内部异常堆栈跟踪结束--- 在System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath,EventTraceActivity eventTraceActivity) 在System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath,EventTraceActivity eventTraceActivity) 进程名称:w3wp 进程ID:4136
该站点在IIS中有两个绑定: https://name.com:443, https://name.com:8443
当我删除其中一个绑定时,无关紧要,错误消失且应用程序正常工作。在搜索中,我发现此命令引用了这种行为:
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
我将其添加到web.config中,但错误仍然存在。这是我浏览jsonfetcher.svc时的堆栈跟踪
[InvalidOperationException:从“SpectrumHR.API.JsonFetcher”类型的CreateServiceHost方法返回的ServiceHostBase对象为null。 System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath,EventTraceActivity eventTraceActivity)+208409 System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo,EventTraceActivity eventTraceActivity)+76 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath,EventTraceActivity eventTraceActivity)+901 [ServiceActivationException:由于编译期间发生异常,无法激活服务'/API/JsonFetcher.svc'。异常消息是:从“SpectrumHR.API.JsonFetcher”类型的CreateServiceHost方法返回的ServiceHostBase对象为null ..] System.Runtime.AsyncResult.End(IAsyncResult result)+624474 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)+196075 System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)+101 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()+913 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,Boolean&amp; completedSynchronously)+165