ASP.NET Core Web Api 2.1's default files work, but controllers return 404 when deployed on IIS 8.5
up vote
0
down vote
favorite
So, I have an Angular 7 application deployed to an instance of IIS 8.5. To serve the actual Angular application, I serve it using the UseDefaultFiles()
method on Startup.cs
.
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
Fair enough. The actual index.html
and related .js files in wwwroot
are served with no complications, and my app works. Then, my Angular app tries to make a request to my Web API, and well...
Failed to load resource: the server responded with a status of 404 (Not Found)
Under what circumstances would this even happen? It works fine on my machine.
angular iis asp.net-core asp.net-core-webapi angular7
add a comment |
up vote
0
down vote
favorite
So, I have an Angular 7 application deployed to an instance of IIS 8.5. To serve the actual Angular application, I serve it using the UseDefaultFiles()
method on Startup.cs
.
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
Fair enough. The actual index.html
and related .js files in wwwroot
are served with no complications, and my app works. Then, my Angular app tries to make a request to my Web API, and well...
Failed to load resource: the server responded with a status of 404 (Not Found)
Under what circumstances would this even happen? It works fine on my machine.
angular iis asp.net-core asp.net-core-webapi angular7
How are you building your Angular application? If you are deploying to a production server you would need to build your angular application to wwwroot and have it posted to the production server.
– David Lee
Nov 19 at 22:44
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
So, I have an Angular 7 application deployed to an instance of IIS 8.5. To serve the actual Angular application, I serve it using the UseDefaultFiles()
method on Startup.cs
.
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
Fair enough. The actual index.html
and related .js files in wwwroot
are served with no complications, and my app works. Then, my Angular app tries to make a request to my Web API, and well...
Failed to load resource: the server responded with a status of 404 (Not Found)
Under what circumstances would this even happen? It works fine on my machine.
angular iis asp.net-core asp.net-core-webapi angular7
So, I have an Angular 7 application deployed to an instance of IIS 8.5. To serve the actual Angular application, I serve it using the UseDefaultFiles()
method on Startup.cs
.
app.UseDefaultFiles();
app.UseStaticFiles();
app.UseAuthentication();
app.UseHttpsRedirection();
app.UseMvc();
Fair enough. The actual index.html
and related .js files in wwwroot
are served with no complications, and my app works. Then, my Angular app tries to make a request to my Web API, and well...
Failed to load resource: the server responded with a status of 404 (Not Found)
Under what circumstances would this even happen? It works fine on my machine.
angular iis asp.net-core asp.net-core-webapi angular7
angular iis asp.net-core asp.net-core-webapi angular7
edited Nov 20 at 9:29
Goncalo Peres
1,0591313
1,0591313
asked Oct 30 at 21:01
F.O. Senn
134
134
How are you building your Angular application? If you are deploying to a production server you would need to build your angular application to wwwroot and have it posted to the production server.
– David Lee
Nov 19 at 22:44
add a comment |
How are you building your Angular application? If you are deploying to a production server you would need to build your angular application to wwwroot and have it posted to the production server.
– David Lee
Nov 19 at 22:44
How are you building your Angular application? If you are deploying to a production server you would need to build your angular application to wwwroot and have it posted to the production server.
– David Lee
Nov 19 at 22:44
How are you building your Angular application? If you are deploying to a production server you would need to build your angular application to wwwroot and have it posted to the production server.
– David Lee
Nov 19 at 22:44
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53072862%2fasp-net-core-web-api-2-1s-default-files-work-but-controllers-return-404-when-d%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
How are you building your Angular application? If you are deploying to a production server you would need to build your angular application to wwwroot and have it posted to the production server.
– David Lee
Nov 19 at 22:44