问题 当我尝试使用 cshtml 扩展访问我的 ASP.NET Web Page Razor 页面时,它们工作正常。如果我删除了扩展,WordPress 会尝试查找 URL,就好像它是一篇博客文章一样,我无法访问该页面或通过 Razor 使用“漂亮”的 URL。
我正在使用 Winhost 托管。我在我的根应用程序目录中安装了 WordPress。该目录包含以下 Web.cofig 文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="index.php"/>
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我的应用程序位于子文件夹“/app”中。您可以通过此处自行测试问题:
http://www.cutrategamer.com/app/game-deals-chart.cshtml
然后尝试去这里:
http://www.cutrategamer.com/app/game-deals-chart/
该页面在我的本地计算机上没有 cshtml 扩展名时可以正常工作。
有谁知道如何解决这个问题?