简体   繁体   English

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

[英]Running Asp.Net Mvc Application Under Php Site (WordPress) on IIS

I've added Asp.Net Mvc Web application as Application to Php Web Site. 我已经将Asp.Net Mvc Web应用程序添加为Php网站的应用程序。 (/asp folder) (/ asp文件夹)

when I call to x.com/asp Asp.Net Web Application must be executed. 当我调用x.com/asp时,必须执行Asp.Net Web应用程序。 But I'm getting this error: 但我收到此错误:

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

I've added these to web.config: 我已经将它们添加到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>

But still php application handles /asp requests? 但是,php应用程序仍然可以处理/ asp请求吗?

What is the solution? 解决办法是什么?

IIS 7.5 Windows Server 2008 R2 IIS 7.5 Windows服务器2008 R2

Php application is WordPress PHP应用程序是WordPress

Getting an ASP.NET MVC application working under WordPress is possible by editing the web.config and then after setting it to read-only so that no changes will be applied by WordPress afterwards. 通过编辑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>

I hope that this can help someone in the future. 我希望这可以在将来对某人有所帮助。 Also it is very important to use Razor commands like @Url.Content() to ensure that the references are handled properly. 同样重要的是,使用诸如@Url.Content()类的Razor命令来确保正确处理引用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM