2012-02-18 35 views
2

問題 當我嘗試使用cshtml擴展名訪問我的ASP.NET Web Page Razor頁面時,它們工作正常。如果我刪除了擴展名,WordPress會嘗試查找URL,就好像它是博客文章一樣,我無法訪問該頁面或通過Razor使用「漂亮」URL。如何在Wordpress中使用Razor託管ASP.NET網頁?

我與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擴展。

有誰知道如何解決這個問題?

回答

2

WordPress的規則之前,添加一條規則趕上/應用交通和停止處理規則,這樣的事情:

<rule name="razorapp" stopProcessing="true"> 
    <match url="^app/*"/> 
    <action type="None" /> 
</rule> 

不知道這是完全正確的,但你應該得到這個想法。在配置中處理wordpress規則之前,您需要將重寫模塊短路。

+1

這就是缺少的。謝謝保羅! – 2012-02-18 14:39:10

相關問題