2014-10-10 59 views
0

將使用MVC4和SDK 2.2的Azure Web角色項目升級到SDK 2.4和MVC5後,僅在模擬器中啓動應用程序,但不在雲中(空頁或「Page不能顯示「)。Azure Web角色MVC5未以集成模式啓動

在虛擬機上進行遠程登錄並將應用程序池模式從集成模式更改爲經典模式之後,還會使用新設置來處理頁面。 web.config中處理程序設置的更改不成功。

與MVC5和SDK2.4

當前的web.config:

<system.webServer> 
<validation validateIntegratedModeConfiguration="false" /> 
<modules> 
    <add name="PageSpeedModule" type="CheckMyBus.Web.Frontend.Modules.ProtectionModule" preCondition="managedHandler" /> 
</modules> 
<handlers> 
<remove name="ExtensionlessUrlHandler-Integrated-4.0" /> 
<remove name="OPTIONSVerbHandler" /><remove name="TRACEVerbHandler" /> 
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> 
<remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> 
</handlers> 
<urlCompression doStaticCompression="true" doDynamicCompression="true" /> 
<httpCompression> 
    <dynamicTypes> 
    <add mimeType="application/json" enabled="true" /> 
    <add mimeType="application/json; charset=utf-8" enabled="true" /> 
    </dynamicTypes> 
</httpCompression> 
<staticContent> 
    <clientCache setEtag="false" /> 
</staticContent> 
<httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" /> 
<rewrite> 
    <rules> 
    <rule name="RemoveIllegalCharacters"> 
     <match url="(.*)(&quot;|%22)(.*)" /> 
     <action type="Rewrite" url="{R:1}{R:3}" /> 
    </rule> 
    <rule name="RemoveTrailingSlashRule1" stopProcessing="true"> 
     <match url="(.*)/$" /> 
     <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     </conditions> 
     <action type="Redirect" url="{R:1}" /> 
    </rule> 
    <rule name="Remove Version from static files" stopProcessing="true"> 
     <match url="(styles|scripts|images)/(.+);v[0-9]+\.(css|js|gif|png|jpg|ico)" /> 
     <action type="Rewrite" url="{R:1}/{R:2}.{R:3}" /> 
    </rule> 
    <rule name="EnforceLowerCase" stopProcessing="true"> 
     <match url="[A-Z]" ignoreCase="false" /> 
     <action type="Redirect" url="{ToLower:{URL}}" /> 
    </rule> 
    </rules> 
</rewrite> 
</system.webServer> 

末web.config中正常工作與MVC4和SDK2.2:

<system.webServer> 
<validation validateIntegratedModeConfiguration="false" /> 
<modules> 
    <add name="PageSpeedModule" type="CheckMyBus.Web.Frontend.Modules.ProtectionModule" preCondition="managedHandler" /> 
</modules> 
    <handlers> 
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" /> 
     <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" /> 

     <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" /> 
     <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" /> 
     <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> 
    <remove name="ExtensionlessUrlHandler-Integrated-4.0" /><remove name="OPTIONSVerbHandler" /><remove name="TRACEVerbHandler" /><add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /></handlers> 
    <urlCompression doStaticCompression="true" doDynamicCompression="true" /> 
<httpCompression> 
    <dynamicTypes> 
    <add mimeType="application/json" enabled="true" /> 
    <add mimeType="application/json; charset=utf-8" enabled="true" /> 
    </dynamicTypes> 
</httpCompression> 
<staticContent> 
    <clientCache setEtag="false" /> 
</staticContent> 
<httpErrors errorMode="DetailedLocalOnly" existingResponse="PassThrough" /> 
<rewrite> 
    <rules> 
    <rule name="RemoveIllegalCharacters"> 
     <match url="(.*)(&quot;|%22)(.*)" /> 
     <action type="Rewrite" url="{R:1}{R:3}" /> 
    </rule> 
    <rule name="RemoveTrailingSlashRule1" stopProcessing="true"> 
     <match url="(.*)/$" /> 
     <conditions> 
     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 
     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 
     </conditions> 
     <action type="Redirect" url="{R:1}" /> 
    </rule> 
    <rule name="Remove Version from static files" stopProcessing="true"> 
     <match url="(styles|scripts|images)/(.+);v[0-9]+\.(css|js|gif|png|jpg|ico)" /> 
     <action type="Rewrite" url="{R:1}/{R:2}.{R:3}" /> 
    </rule> 
    <rule name="EnforceLowerCase" stopProcessing="true"> 
     <match url="[A-Z]" ignoreCase="false" /> 
     <action type="Redirect" url="{ToLower:{URL}}" /> 
    </rule> 
    </rules> 
</rewrite> 
</system.webServer> 

每個人都可以幫助我嗎?

+0

檢查Web角色的事件日誌以查看.NET框架中的錯誤或警告。 – astaykov 2014-10-10 13:24:32

+0

事件日誌不包含錯誤和警告。 – user2209131 2014-10-10 14:03:08

+0

問題解決了! SDK 2.4的nuget更新沒有更新views文件夾中的web.config。有包含以前的MVC dll版本的參考。 – user2209131 2014-10-10 14:05:57

回答

0

手動升級到MVC5後,我沒有意識到,Views中的pages-clause weg.config有三個對System.Web.Mvc的引用。這使得網絡角色永遠留存下來。

解決這個問題解決了我的循環問題。