Hosting ember app inside web project ( MVC)

After much struggling I got my ember app to build for production.

I need to serve this app inside an mvc project, so placed all in my dist folder inside a root folder in my mvc project.

Then I got a MVC controller that serve up the index.html above.

I seems to got everything down except what is inside this meta tag in my index.html <meta name="myapp/config/environment" content="%7B%22modulePrefix%22%3A%22myapp%22%2C%22host%22%3A%22https%3A//localhost/parentapp/console%22%2C%22environment%22%3A%22production%22%2C%22rootURL%22%3A%22/_console/%22%2C%22locationType%22%3A%22auto%22%2C%22EmberENV%22%3A%7B%22FEATURES%22%3A%7B%7D%7D%2C%22APP%22%3A%7B%22name%22%3A%22myapp%22%2C%22version%22%3A%220.0.0+17d24240%22%7D%2C%22exportApplicationGlobal%22%3Afalse%2C%22ember-devtools%22%3A%7B%22global%22%3Atrue%2C%22enabled%22%3Afalse%7D%7D" />

This cause the following error in my console: Uncaught UnrecognizedURLError: /myapp/console What is also weird if I go to “https://localhost/myparentapp/console” my url changes to “https://localhost/_console/myparentapp/console”. This does not happen when I remove that meta tag, but then get an error in the console "Could not read config from meta tag with name “myparentapp/config/environment”

So while this all make sense, I got no idea how to fix it, because obviously something in that meta tag I cannot figure out.

in my experience, it sucks to host an ember app under a .net mvc app (routing especially) … but question: is _console/app/console indented as your rootUrl or was this a typo? Also, you mentioned, this is sitting in the root of your app, but is your .net routing serving that directory? is that directory publicly accessible? I’d say move your client app to somewhere under wwwroot (or the old Scripts directory) as these dirs are publicly accessible. If you leave it in the root, you’ll have to write a routing rule for your app.

1 Like

Thanks for the advice Santos. Unfortunately, I have to place the app (ember) in the root of the project (MVC) as the client requested. They already have an Angular app set up that way (*siteroot/_app, where my whole ember app is in *siteroot/_console) I think my problem is not understanding the configuration settings that need be set. (3 months but I’m still an Ember n00b)

At them moment I have this: if (environment === ‘production’) { ENV.rootURL= ‘/mvcapp/_console/’; = ‘/’; } What I’m doing right now is keep fiddling with that, build for production and place the content of the dist folder (ember) into /_console (folder in MVC app)

tsantos83: Your reply put me on the right track. Just had to change _console (folder name) to console (route name) in the root URL. Thank you very much!