Refresh with angular + IIS

Asked

Viewed 83 times

0

I published an angular application on IIS and at first my application works normally, but when I refresh the page, I get a Not Found error. I looked at several websites and saw that it was necessary to create a Webconfig file in the same folder where your angular files are. I did it, but still the same mistake.

Here is my Webconfig:

<?xml version="1.0" encoding="UTF-8"?> 
<configuration> 
<system.webServer> 
    <rewrite> 
        <rules> 
            <rule name="TestDrive"> 
                <match url=".*" /> 
                <conditions logicalGrouping="MatchAll"> 
                  <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" pattern="" ignoreCase="false" /> 
                </conditions> 
                <action type="Rewrite" url="./" appendQueryString="true" /> 
            </rule> 
        </rules> 
    </rewrite> 
</system.webServer> 

Here is the application configuration print on IIS

inserir a descrição da imagem aqui

Pool options

inserir a descrição da imagem aqui

Could someone help me?

  • How is the pool setup? is a site or an application within another site?

  • It’s a website. And the pool is like 'Defaultapppool'. Anyway, I’ll edit my question by putting a print of how it is.

  • So by print it is not a site, but an application within your default site, so much so that you should be accessing it by http://localhost/TestDrive, while its angular application is not recognizing this subdirectory as its root...

  • Got it! but how do I solve this problem?

  • It depends on how it will be in production... but create a new website for your application or if you will not have any more simply point out the path of the "Default Web Site" to your application: "C: Inetpub wwwroot Testdrive"

  • I created a new Site just as you asked, however, without Webconfig from the same error, it opens the screen and in the refresh is presented error 404. And with Webconfig he doesn’t even open the screen anymore...

  • So, I believe not, because when running on my machine other than by IIS, it works normally.

  • Beauty! Just 1 min

  • Change the pool of this site to Unmanaged and classic, another question as is your <base href>

  • I don’t have that option! I will put in question the options of Pool I have

  • Edit the Testdrive pool

  • Already this as Testdrive! Remembering that if I take the Webconfig, the screen opens normally, but without the refresh work! and with Webconfig, the screen doesn’t even open

  • maybe I can help you: http://getgoingit.blogspot.com/2018/02/publishing-and-deploying-angular-4.html, there are a few more steps than you did

Show 8 more comments

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.