在IIS上的Php站点(WordPress)下运行Asp.Net Mvc应用程序

时间:2014-11-16 21:55:08

标签: php asp.net-mvc iis

我已将Asp.Net Mvc Web应用程序添加为Php网站的应用程序。 (/ asp文件夹)

当我打电话给x.com/asp时,必须执行Asp.Net Web应用程序。 但是我收到了这个错误:

HTTP Error 403.18 - Forbidden
The specified request cannot be processed in the application pool that is configured for this      resource on the Web server.
Detailed Error Information
Module  IIS Web Core
Notification    BeginRequest
Handler php-5.6.2
Error Code  0x00000000
Requested URL   http://www.x.com:80/index.php
Physical Path   D:\WebSites\x.com\index.php
Logon Method    Not yet determined
Logon User  Not yet determined

我已将这些添加到web.config:

<validation validateIntegratedModeConfiguration="false" />
<handlers>
        <remove name="PHP_via_FastCGI" />
<remove name="php-5.6.2" />
   <remove name="PHP53_via_FastCGI" />
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
  <remove name="OPTIONSVerbHandler" />
  <remove name="TRACEVerbHandler" />

  <add name="OzImageHandler" verb="GET" path="/gorsel/*" type="Oz.Services.ImageHandler, Oz.Services" />
  <!--<add name="LoggerHandler" verb="*" path="*.logger" type="JSNLog.LoggerHandler, JSNLog" resourceType="Unspecified" />-->

  <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
<modules runAllManagedModulesForAllRequests="true">

  <remove name="RoleManager" />
  <remove name="Session" />
  <add name="Session" type="System.Web.SessionState.SessionStateModule" />
</modules>

但仍然是php应用程序处理/ asp请求?

解决方案是什么?

IIS 7.5 Windows Server 2008 R2

Php应用程序是WordPress

1 个答案:

答案 0 :(得分:0)

通过编辑web.config然后将其设置为只读后,可以在WordPress下运行ASP.NET MVC应用程序,以便之后WordPress不会应用任何更改。

<rule name="asp.netwebsite" patternSyntax="ECMAScript" stopProcessing="false">
            <match url=".*/virtualdirectory.*" />
            <action type="None" />
                <conditions>
                </conditions>
        </rule>
        <rule name="wordpress" patternSyntax="ECMAScript" stopProcessing="true">
            <match url="^store.*" negate="true" />
                <conditions>
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <add input="{REQUEST_URI}" pattern="^virtualdirectory.*" negate="true" />
                </conditions>
            <action type="Rewrite" url="Index.php" logRewrittenUrl="true" />
        </rule>
    </rules>

我希望这可以帮助将来的某个人。 此外,使用像@Url.Content()这样的Razor命令来确保正确处理引用非常重要。