在IIS中苗条运行时找不到页面

问题描述 投票:0回答:2

我正在尝试在IIS中运行超薄应用程序,我将其添加为默认网站中的应用程序,我已经从.htaccess导入了规则,并将物理地址更新为public,但是仍然找不到页面请注意,当我将其添加为网站(不在“默认”网站中)时,它可以工作!但是我需要在默认网站中运行它,才能使用公共IP通过网络访问它。enter image description here

这里是web.config文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 1" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="index.php" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

任何建议都非常感谢!

iis url-rewriting web-config slim
2个回答
0
投票

如果要直接使用公用IP地址而不添加端口(这意味着使用80端口),则应在不使用80的情况下修改默认网站的端口,并为新网站添加80端口绑定。

详细信息,您可以参考以下步骤:

1。打开IIS管理控制台,右键单击“默认网站”,然后单击编辑绑定。

2。选择80端口绑定并将其修改为另一个端口。

enter image description here

3。打开另一个Web应用程序,并向其添加80端口绑定。


0
投票

错误的原因是由于先前添加了其他设置,以使Slim App在dependencies.php文件中的Apache服务器中工作,因此>

    $container['environment'] = function () {
     // Fix the Slim 3 subdirectory issue (#1529)
     // This fix makes it possible to run the app from localhost/slim3-app
     $scriptName = $_SERVER['SCRIPT_NAME'];
     $_SERVER['REAL_SCRIPT_NAME'] = $scriptName;
     $_SERVER['SCRIPT_NAME'] = dirname(dirname($scriptName)) . '/' . basename($scriptName);
     return new Slim\Http\Environment($_SERVER);
   };

通过删除它并检查项目权限,我可以正常运行!

© www.soinside.com 2019 - 2024. All rights reserved.