在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的节是错误的。此错误可能是由于虚拟目录未被配置为IIS中的应用程序。将WCF服务与其他应用程序发布到外部IIS服务器
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
我理解,这是一个很常见的,模糊的错误,并有一吨的关于它的问题了,但他们都没有解决我的问题。所以我会尽量做得更彻底,更具体:
这是一个WCFService,我通过FTP发布到外部IIS服务器。我得到这个错误,当我尝试在浏览器中查看网站在https://www.domain.com/correctdirectory/JobsService.svc
这是我Web.config
:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=*token*" requirePermission="false" />
</configSections>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.1" />
<httpRuntime targetFramework="4.5.1" />
<customErrors mode="Off"></customErrors>
<httpModules>
</httpModules>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfiguration">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="WcfServiceAPI.Services.Validation.ValidationService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfiguration" contract="WcfServiceAPI.Services.Validation.IValidationService"/>
</service>
<service name="WcfServiceAPI.Services.Jobs.JobsService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfiguration" contract="WcfServiceAPI.Services.Jobs.IJobsService"/>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ApplicationInsightsWebTracking" />
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" preCondition="managedHandler" />
</modules>
<directoryBrowse enabled="true" />
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
这里是我所确信的东西:
- 项目是cleaned in both Debug and Release mode。
- 项目以调试模式构建。
- IIS根中的Web.config与此Web.config不冲突。它基本上只是强制执行https,并处理不同的文件类型请求。
- 服务托管为上的IIS应用程序(不只是一个虚拟目录)
当我把它发布到内部网络上的服务器,有没有其他网站或服务,它工作正常。
我知道我尝试发布的服务器上有很多其他应用程序,但我的应用程序位于根级别,所以这应该没关系,对不对? 如果重要,我也知道这些应用程序中至少有一个是ASMX Web服务。服务器的所有者也不知道问题。
我也试着把我的项目降级到.NET 4.0,因为我知道他的ASMX服务在那上面运行。
任何想法?