我已经在Windows 10上为我的.net WCF服务创建了一个IIS v.10开发环境。该服务似乎可以正常工作,除了.svc文件返回了一个405方法,当我通过POST predicate 调用它们时,该方法是不允许的。到目前为止,我听到的最好的建议是,我在安装IIS之前安装了VS,我应该卸载所有内容并重新开始,这次先安装IIS。
<EventData>
<Data>System.ServiceModel.ServiceHostingEnvironment+HostingManager/30405926</Data>
<Data>System.ServiceModel.ServiceActivationException: The service '/blah.svc' cannot be activated due to an exception during compilation. The exception message is: Service 'com.blah.webservice.zzz.blah' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.. ---> System.InvalidOperationException: Service 'com.blah.webservice.zzz.blah' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.
at System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreApplicationEndpoints(ServiceDescription description)
at System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost)
at System.ServiceModel.ServiceHostBase.InitializeRuntime()
at System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
--- End of inner exception stack trace ---
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath, EventTraceActivity eventTraceActivity)</Data>
<Data>w3wp</Data>
<Data>13140</Data>
</EventData>
请注意,完全相同的代码在其他三个Windows 10开发环境中工作,因此这向我表明,代码或web.config没有任何问题。
IIS中的处理程序Map似乎很好,错误说这是一个编译错误,那么还有什么可能导致它不能在这个Win 10机器上编译,而不是其他机器呢?
1条答案
按热度按时间ttygqcqt1#
我在IIS中删除了该站点,并几乎完全按照以前的方式重新创建了该站点,但我没有只绑定https和端口443,而是还绑定了http和端口80。这似乎毫无意义,因为该站点只运行https,但我想微软可能有一个懒惰的开发人员会说:“足够接近政府工作”,并需要http和端口80。突然它开始工作。为了确认这是否是修复它的原因,我关闭了http绑定,果然500错误又回来了。