简体   繁体   中英

Azure AngularJS Index.html

My AngularJS app requires all actions to redirect to index.html for processing and it works fine on localhost, but it doesn't work in Azure. For example:

localhost:1234 -> localhost:1234/#/ works

myapp.com -> myapp.com/#/ doesn't work

myapp.com/index.html -> myapp.com/index.html#/ works

I added:

<system.webServer xdt:Transform="Replace">
<rewrite>
  <rules>
    <rule name="redirect all requests" stopProcessing="true">
      <match url="^(.*)$" ignoreCase="false" />
      <conditions logicalGrouping="MatchAll">
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" />
      </conditions>
      <action type="Rewrite" url="index.html" appendQueryString="true" />
    </rule>
  </rules>
</rewrite>
</system.webServer>

The weird thing is that this works sometimes. I can't for the life of me figure out why sometimes going to myapp.com -> myapp.com/#/ works and other times it doesn't. It seems to also break myapp.com/index.html#/ but only sometimes. This is without making any deployment changes. It just works about half the time.

Edit

Here is the actual error message:

Microsoft.Owin, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

It might be about application startup. Here are some troubleshooting ideas.

Restart your app. Does that reliably cause the error?

Turn on application logging. portal.azure.com > Browse All > The Site Name > Settings > Diagnostic logs > Application Logging > Level Error. If you want lots of stuff, set level to verbose and turn on web server logging, detailed error messages, and failed request tracing.

View diagnostics at service control manager mysite.scm.azurewebsites.net. Choose Debug console > PowerShell. Now you can look through the logs at home/LogFiles .

Based on the error you are receiving, it looks like Owin is the problem. Check your websites bin to see if there are any Owin references. From the online service control manager, you can try this:

cd site/wwwroot/bin
Get-ChildItem -filter *Owin*

If there is anything there, then it's probably the cause of the particular error you are receiving.

在线服务控制管理器-带过滤器的Get-ChildItem

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM