Azure Web角色MVC5无法以集成模式启动

时间:2014-10-10 12:09:31

标签: asp.net asp.net-mvc-4 azure azure-web-roles

将我的Azure Web角色项目与MVC4和SDK 2.2升级到SDK 2.4和MVC5后,仅在模拟器中启动应用程序,而不是在云中启动(空页或“页面无法显示”)。

在VM上远程登录并将应用程序池模式从集成更改为经典后,还可以使用新设置处理页面。 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>

每个人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

手动升级到MVC5后,我没有意识到Views weg.config中的pages子句有三个对System.Web.Mvc的引用。这使得网络角色永远回归。

解决这个问题解决了我的循环问题。