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
Pool options
Could someone help me?
How is the pool setup? is a site or an application within another site?
– Leandro Angelo
It’s a website. And the pool is like 'Defaultapppool'. Anyway, I’ll edit my question by putting a print of how it is.
– Guilherme Nunes
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...– Leandro Angelo
Got it! but how do I solve this problem?
– Guilherme Nunes
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"
– Leandro Angelo
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...
– Guilherme Nunes
So, I believe not, because when running on my machine other than by IIS, it works normally.
– Guilherme Nunes
Beauty! Just 1 min
– Guilherme Nunes
Change the pool of this site to Unmanaged and classic, another question as is your
<base href>
– Leandro Angelo
I don’t have that option! I will put in question the options of Pool I have
– Guilherme Nunes
Edit the Testdrive pool
– Leandro Angelo
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
– Guilherme Nunes
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
– Pedro