IIS重新启动后,WCF Web服务无法正常工作 [英] WCF Web Service not working after IIS restart

查看:100
本文介绍了IIS重新启动后,WCF Web服务无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在IIS 7.5上运行的Web服务

I have a web service running on IIS 7.5

每当我重新启动该Web服务正在运行的网站的IIS或AppPool时,我都会收到以下错误消息.然后我发现,如果我将编译版本(从4.5更改为4.0或从4.0更改为4.5)并保存web.config文件,则它将开始正常运行.这真的很奇怪.有人可以帮我吗?

Whenever I restart the IIS or the AppPool of the website this web service is running I am getting the error message below. Then I found out that, if I change the complilation version (either from 4.5 to 4.0 or if it is 4.0 to 4.5) and save the web.config file then it starts working regularly. This is really weird. Can anybody help me on this please.

web.config:

web.config:

<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
    <connectionStrings>
        <add name="NetDBEntities" connectionString="metadata=res://*/EFatura.csdl|res://*/EFatura.ssdl|res://*/EFatura.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=***********;initial catalog=*****;persist security info=True;user id=sa;password=***************;MultipleActiveResultSets=True;App=NSEfatLib&quot;" providerName="System.Data.EntityClient" />
    </connectionStrings>
    <system.serviceModel>
    <services>
        <service name="NSEfatLib.NSEfatEntryPoint">
        <endpoint address="Cari" binding="basicHttpBinding" bindingConfiguration=""
          name="Cari" contract="NSEfatLib.ICari" />
        <endpoint address="Stok" binding="basicHttpBinding" bindingConfiguration=""
          name="Stok" contract="NSEfatLib.IStok" />
        <endpoint address="FaturaIslemler" binding="basicHttpBinding"
          bindingConfiguration="" name="FaturaIslemler" contract="NSEfatLib.IFaturaIslemler" />
        <endpoint address="DefterIslemler" binding="basicHttpBinding"
          bindingConfiguration="" name="DefterIslemler" contract="NSEfatLib.IDefterIslemler" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
      <add binding="basicHttpsBinding" scheme="https"/>
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
  </system.serviceModel>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
    <directoryBrowse enabled="true"/>
  </system.webServer>
</configuration>

错误消息:

作为服务提供的类型"NSEfatLib.NSEfatEntryPoint" ServiceHost指令中的属性值,或在 配置元素 system.serviceModel/serviceHostingEnvironment/serviceActivations可以 找不到.说明:在处理期间发生未处理的异常 当前Web请求的执行.请检查堆栈跟踪 有关该错误及其起源的更多信息 代码.

The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. 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.

异常详细信息:System.InvalidOperationException:类型 "NSEfatLib.NSEfatEntryPoint",作为服务属性值提供 在ServiceHost指令中,或在配置元素中提供 system.serviceModel/serviceHostingEnvironment/serviceActivations可以 找不到.

Exception Details: System.InvalidOperationException: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.

源错误:

在执行过程中生成了未处理的异常 当前的Web请求.有关原产地和位置的信息 可以使用下面的异常堆栈跟踪来识别异常.

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.

堆栈跟踪:

[InvalidOperationException:类型为'NSEfatLib.NSEfatEntryPoint', 作为ServiceHost指令中的Service属性值提供, 或在配置元素中提供 system.serviceModel/serviceHostingEnvironment/serviceActivations可以 找不到.]
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(字符串 constructorString,Uri [] baseAddresses)+122516
System.ServiceModel.HostingManager.CreateService(字符串 normalizedVirtualPath,EventTraceActivity eventTraceActivity)+1451
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo,EventTraceActivity,eventTraceActivity)+76
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath,EventTraceActivity eventTraceActivity)+901

[InvalidOperationException: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +122516
System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +1451
System.ServiceModel.HostingManager.ActivateService(ServiceActivationInfo serviceActivationInfo, EventTraceActivity eventTraceActivity) +76
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) +901

[ServiceActivationException:服务'/Service.svc'不能为 由于编译期间发生异常而被激活.例外 消息是:类型为"NSEfatLib.NSEfatEntryPoint",作为 ServiceHost指令中的服务属性值,或在 配置元素 system.serviceModel/serviceHostingEnvironment/serviceActivations可以 找不到..] System.Runtime.AsyncResult.End(IAsyncResult结果) +650220 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果)+210733
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar)+282

[ServiceActivationException: The service '/Service.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..] System.Runtime.AsyncResult.End(IAsyncResult result) +650220 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +210733
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +282

事件日志条目:

System.ServiceModel.ServiceHostingEnvironment + HostingManager/62476613 System.ServiceModel.ServiceActivationException:服务 由于期间发生异常,无法激活"/Service.svc" 汇编.异常消息是:类型 "NSEfatLib.NSEfatEntryPoint",作为服务属性值提供 在ServiceHost指令中,或在配置元素中提供 system.serviceModel/serviceHostingEnvironment/serviceActivations可以 找不到.---> System.InvalidOperationException:类型 "NSEfatLib.NSEfatEntryPoint",作为服务属性值提供 在ServiceHost指令中,或在配置元素中提供 system.serviceModel/serviceHostingEnvironment/serviceActivations可以 找不到.在 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(字符串 ConstructorString,Uri [] baseAddresses)位于 System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(字符串 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(字符串 relativeVirtualPath,EventTraceActivity eventTraceActivity)w3wp
5028

System.ServiceModel.ServiceHostingEnvironment+HostingManager/62476613 System.ServiceModel.ServiceActivationException: The service '/Service.svc' cannot be activated due to an exception during compilation. The exception message is: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.. ---> System.InvalidOperationException: The type 'NSEfatLib.NSEfatEntryPoint', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found. at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath, EventTraceActivity eventTraceActivity) 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) w3wp
5028

推荐答案

预编译Web服务时,引发了上述错误.我尝试了该服务正常运行(没有预编译),并且问题不再出现.

Interestingly above error was fired when the web service was precompiled. I tried the service to run regularly (without precomopiling) and the issue is not appearing anymore.

我在Web服务中使用的是库,因此实际上Web服务本身根本没有任何代码.也许这就是原因.无论如何,因为没有代码,所以没有预编译也是可以的.

I was using a library within the web service, so practically the web service itself did not have any code at all. Maybe that is the reason. Anyways, as there is no code, no precompilation is fine too.

这篇关于IIS重新启动后,WCF Web服务无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆