使用其他应用程序将WCF服务发布到外部IIS服务器


在应用程序级别之外使用注册为allowDefinition ='MachineToApplication'的部分是错误的。此错误可能是由于虚拟目录未配置为IIS中的应用程序引起的。

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.



    </service>
  </services>
  <serviceHostingEnvironment aspNetCompatibilityEnabled="true"
      multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>

我知道这是一个非常常见且含糊不清的错误,并且已经有很多关于它的问题,但他们都没有解决我的问题。因此,我将尝试更加彻底和具体:

I understand this is a very common and ambiguous error, and that there's a ton of questions about it already, but none of them have solved my issue. So I'll try to be more thorough and specific:

我正在通过FTP发布到外部IIS服务器 WCFService 。当我尝试在浏览器中查看该网站时出现此错误: https://www.domain .com / correctdirectory / JobsService.svc

It's a WCFService that I'm publishing to an external IIS server via FTP. I get this error when I try to view the site in my browser at 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>

以下是我确定的事项:


  1. 项目在调试和发布模式下清除

  2. 项目是在调试模式下构建的。

  3. IIS根目录中的Web.config与此Web.config不冲突。它基本上只执行https,并处理不同的文件类型请求。

  4. 该服务作为IIS上的应用程序(不仅仅是虚拟目录)托管

  1. Project is cleaned in both Debug and Release mode.
  2. Project is built in Debug mode.
  3. The Web.config in the IIS root does not conflict with this Web.config. It basically just enforces https, and handles different filetype requests.
  4. The service is hosted as an application on the IIS (not just a virtual directory)

当我将其发布到内部网络上没有其他网站或服务的服务器时,它工作正常。

It works fine when I publish it to a server on the internal network, that has no other websites or services.

我知道我正在尝试发布的服务器上有很多其他应用程序,但我的应用程序是在根级别,所以这应该不重要,对吧?
如果重要,我也知道这些应用程序中至少有一个是ASMX Web服务。服务器的所有者也不知道问题。

I know there's a lot of other applications on the server I'm trying to publish to, but my application is at the root level, so that shouldn't matter, right? If it matters, I also know that at least one of those applications is an ASMX web service. The owner of the server doesn't know the problem either.

我也尝试将我的项目降级到.NET 4.0,因为我知道他的ASMX服务运行在。

I've also tried downgrading my project to .NET 4.0, since I know his ASMX service runs on that.

任何想法?



 1 条回答