I am trying to serve an ember app from IIS.
I created a new app using ember new my-app
and then ran ember build --environment production
. This generated the files in the dist
directory as expected.
On the IIS side, I added a new website on the server and mapped the dist
folder from the last step.
Now, when I navigate to localhost/index.html
I get a blank page.
I checked the source of the page and the js files are being served correctly as expected. This would mean that it's the templates that are not being retrieved correctly. In the chrome inspector console there is an exception which says Uncaught: UnrecognizedURLError: /index.html
. The ember inspector says 'Ember application not detected!'.
I've tried the solutions mentioned here, but none has worked for me.
Has anyone else experienced this problem/know how to fix this?
Ember Router uses location: history
by default. This means, it assumes that /index.html
is your route. But obviously it's not defined so the router throws UnrecognizedURLError
.
There are several solutions for your problem:
Set locationType: 'hash'
in config/environment.js
of your ember application. This will force Ember router to use #
in url for routing and in your case this would be like localhost/index.html#your/route
.
Configure your IIS instance to handle index.html
as a default document. To do this, open your server config and make sure it has the key:
index.aspx
instead of index.html
. You can read about it here.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With