Base solution for your next web application
Open Closed

ROUTING Problem to next page #3493


User avatar
0
kwanp created

Hi after i publish to the server when i click change the language or click on password reset link from e-mail, it show "404 - File or directory not found."

Thank you


8 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Are you using angular2 version ?

    If so, please put following web.config into your website. <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/dev/angular/web.config">https://github.com/aspnetzero/aspnet-ze ... web.config</a>

    Thanks.

  • User Avatar
    0
    kwanp created

    Hi my version is: ASP.NET CORE + ANGULAR 4.X after i put we.config to folder that i publish angular the error show "500 - Internal Server Error" and when i remove web.config server come to live again

    Thank you

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kwanp,

    Does it cause same problem when you hit F5 button on user list page for example ? If so, this is related to web.config I mentioned.

    After putting web.config to your deployed folder, you also need to install IIS url rewrite module.

    Last one question, do you publish your projects (Host & angualr client) seperately or merged ?

    Thanks.

  • User Avatar
    0
    kwanp created

    i publish my project separate angular run on port 80 and asp.net core run on port 2000

    i will try to install IIS url rewrite module

    Thank you

  • User Avatar
    0
    kwanp created

    Hi After i install IIS url rewrite module then restart IIS server and then put web.config to angular publish folder,

    then error show

    after i remove web.config from the folder my web come to live again

    how can i solve this problem

    Thank you

  • User Avatar
    0
    alper created
    Support Team

    can you share your web.config?

  • User Avatar
    0
    kwanp created

    This is my we.config that i use

    ?<?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <system.webServer>
        <staticContent>
          <remove fileExtension=".json" />
          <mimeMap fileExtension=".json" mimeType="application/json" />
        </staticContent>
        
        <rewrite>
          <rules>
            <rule name="Angular Routes" stopProcessing="true">
              <match url=".*" />
              <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" />
              </conditions>
              <action type="Rewrite" url="/" />
            </rule>
          </rules>
        </rewrite>
      </system.webServer>
    </configuration>
    

    After i copy and paste this code i just know that error on code from the beginning with ? and after i remove i got it to work now Thank you

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @kwanp,

    We can arrange a remote meeting for tomorrow to solve your problem. We are available between 09:00 to 17:00 UTC +3.

    Please send your availability to <a href="mailto:[email protected]">[email protected]</a>.

    Thanks.