Angular Live Development Server api requests not found









up vote
0
down vote

favorite












really confused about this and don't know where to start.



Basically i have generated a new angular project with the "dotnet new angular" command.



Im using a fresh machine, node, npm etc etc are all up to date.



My issue is this template just does not work out of the box. When i run the application, all of the frontend will load however, any requests to the api's etc will 404 stating that it cannot find the url.



Message in Chrome console: "Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment..."



My application runs on a different port everytime I execute the "dotnet run" command. Is this supposed to be the case ? Whichever port is generated, this will be the problematic one.



I have to manually change to port 5001 for anything to function correctly (although this comes with annoying security prompts.)



I am using visual studio code for this project. The funny thing is, if i run this project via visual studio (not code) i get a consistent static port number that will function as intended (this also comes with annoying security prompts) so i have to assume its this random port number that vscode is generating ?



Im honestly not to familiar with this so I could be way off admittedly. Any help or advice would be appreaciated. I'd post code snippets if I knew where to start.



PS, I know that I can of course just not run it with VSCode and just stick to Visual Studio. I'd rather understand the issue than ignore it though.



Thanks, in advance.










share|improve this question























  • What commands are you using? Also what do you mean "any requests to the api's etc will 404"?
    – obl
    Nov 8 at 22:58










  • Hi, im just using the "dotnet new angular" command to generate the project using the terminal in VS Code. From there I use "dotnet run". In the terminal I will get 3 messages: Now listening on: localhost:5001 Now listening on: localhost:5000 and Angular Live Development server listsening on localhost.... This last one changes port number everytime i use the dotnet run command. If i try to access my api on this port i will get a 404 "not found" response in Google Chrome console
    – Gilmo
    Nov 11 at 23:13







  • 1




    That's because your .NET API is running on localhost:5001, the other port is for @angular/cli
    – obl
    Nov 12 at 5:15










  • Ah ok, I think I understand. At least enough to research a little further anyway. Thanks for pointing me in the right direction.
    – Gilmo
    Nov 12 at 9:01










  • So for example in the template, you could call the WeatherForecasts action on the api with https://localhost:5001/api/SampleData/WeatherForecasts
    – obl
    Nov 12 at 15:15














up vote
0
down vote

favorite












really confused about this and don't know where to start.



Basically i have generated a new angular project with the "dotnet new angular" command.



Im using a fresh machine, node, npm etc etc are all up to date.



My issue is this template just does not work out of the box. When i run the application, all of the frontend will load however, any requests to the api's etc will 404 stating that it cannot find the url.



Message in Chrome console: "Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment..."



My application runs on a different port everytime I execute the "dotnet run" command. Is this supposed to be the case ? Whichever port is generated, this will be the problematic one.



I have to manually change to port 5001 for anything to function correctly (although this comes with annoying security prompts.)



I am using visual studio code for this project. The funny thing is, if i run this project via visual studio (not code) i get a consistent static port number that will function as intended (this also comes with annoying security prompts) so i have to assume its this random port number that vscode is generating ?



Im honestly not to familiar with this so I could be way off admittedly. Any help or advice would be appreaciated. I'd post code snippets if I knew where to start.



PS, I know that I can of course just not run it with VSCode and just stick to Visual Studio. I'd rather understand the issue than ignore it though.



Thanks, in advance.










share|improve this question























  • What commands are you using? Also what do you mean "any requests to the api's etc will 404"?
    – obl
    Nov 8 at 22:58










  • Hi, im just using the "dotnet new angular" command to generate the project using the terminal in VS Code. From there I use "dotnet run". In the terminal I will get 3 messages: Now listening on: localhost:5001 Now listening on: localhost:5000 and Angular Live Development server listsening on localhost.... This last one changes port number everytime i use the dotnet run command. If i try to access my api on this port i will get a 404 "not found" response in Google Chrome console
    – Gilmo
    Nov 11 at 23:13







  • 1




    That's because your .NET API is running on localhost:5001, the other port is for @angular/cli
    – obl
    Nov 12 at 5:15










  • Ah ok, I think I understand. At least enough to research a little further anyway. Thanks for pointing me in the right direction.
    – Gilmo
    Nov 12 at 9:01










  • So for example in the template, you could call the WeatherForecasts action on the api with https://localhost:5001/api/SampleData/WeatherForecasts
    – obl
    Nov 12 at 15:15












up vote
0
down vote

favorite









up vote
0
down vote

favorite











really confused about this and don't know where to start.



Basically i have generated a new angular project with the "dotnet new angular" command.



Im using a fresh machine, node, npm etc etc are all up to date.



My issue is this template just does not work out of the box. When i run the application, all of the frontend will load however, any requests to the api's etc will 404 stating that it cannot find the url.



Message in Chrome console: "Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment..."



My application runs on a different port everytime I execute the "dotnet run" command. Is this supposed to be the case ? Whichever port is generated, this will be the problematic one.



I have to manually change to port 5001 for anything to function correctly (although this comes with annoying security prompts.)



I am using visual studio code for this project. The funny thing is, if i run this project via visual studio (not code) i get a consistent static port number that will function as intended (this also comes with annoying security prompts) so i have to assume its this random port number that vscode is generating ?



Im honestly not to familiar with this so I could be way off admittedly. Any help or advice would be appreaciated. I'd post code snippets if I knew where to start.



PS, I know that I can of course just not run it with VSCode and just stick to Visual Studio. I'd rather understand the issue than ignore it though.



Thanks, in advance.










share|improve this question















really confused about this and don't know where to start.



Basically i have generated a new angular project with the "dotnet new angular" command.



Im using a fresh machine, node, npm etc etc are all up to date.



My issue is this template just does not work out of the box. When i run the application, all of the frontend will load however, any requests to the api's etc will 404 stating that it cannot find the url.



Message in Chrome console: "Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment..."



My application runs on a different port everytime I execute the "dotnet run" command. Is this supposed to be the case ? Whichever port is generated, this will be the problematic one.



I have to manually change to port 5001 for anything to function correctly (although this comes with annoying security prompts.)



I am using visual studio code for this project. The funny thing is, if i run this project via visual studio (not code) i get a consistent static port number that will function as intended (this also comes with annoying security prompts) so i have to assume its this random port number that vscode is generating ?



Im honestly not to familiar with this so I could be way off admittedly. Any help or advice would be appreaciated. I'd post code snippets if I knew where to start.



PS, I know that I can of course just not run it with VSCode and just stick to Visual Studio. I'd rather understand the issue than ignore it though.



Thanks, in advance.







visual-studio-code .net-core angular-template






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 23:26

























asked Nov 8 at 19:58









Gilmo

295




295











  • What commands are you using? Also what do you mean "any requests to the api's etc will 404"?
    – obl
    Nov 8 at 22:58










  • Hi, im just using the "dotnet new angular" command to generate the project using the terminal in VS Code. From there I use "dotnet run". In the terminal I will get 3 messages: Now listening on: localhost:5001 Now listening on: localhost:5000 and Angular Live Development server listsening on localhost.... This last one changes port number everytime i use the dotnet run command. If i try to access my api on this port i will get a 404 "not found" response in Google Chrome console
    – Gilmo
    Nov 11 at 23:13







  • 1




    That's because your .NET API is running on localhost:5001, the other port is for @angular/cli
    – obl
    Nov 12 at 5:15










  • Ah ok, I think I understand. At least enough to research a little further anyway. Thanks for pointing me in the right direction.
    – Gilmo
    Nov 12 at 9:01










  • So for example in the template, you could call the WeatherForecasts action on the api with https://localhost:5001/api/SampleData/WeatherForecasts
    – obl
    Nov 12 at 15:15
















  • What commands are you using? Also what do you mean "any requests to the api's etc will 404"?
    – obl
    Nov 8 at 22:58










  • Hi, im just using the "dotnet new angular" command to generate the project using the terminal in VS Code. From there I use "dotnet run". In the terminal I will get 3 messages: Now listening on: localhost:5001 Now listening on: localhost:5000 and Angular Live Development server listsening on localhost.... This last one changes port number everytime i use the dotnet run command. If i try to access my api on this port i will get a 404 "not found" response in Google Chrome console
    – Gilmo
    Nov 11 at 23:13







  • 1




    That's because your .NET API is running on localhost:5001, the other port is for @angular/cli
    – obl
    Nov 12 at 5:15










  • Ah ok, I think I understand. At least enough to research a little further anyway. Thanks for pointing me in the right direction.
    – Gilmo
    Nov 12 at 9:01










  • So for example in the template, you could call the WeatherForecasts action on the api with https://localhost:5001/api/SampleData/WeatherForecasts
    – obl
    Nov 12 at 15:15















What commands are you using? Also what do you mean "any requests to the api's etc will 404"?
– obl
Nov 8 at 22:58




What commands are you using? Also what do you mean "any requests to the api's etc will 404"?
– obl
Nov 8 at 22:58












Hi, im just using the "dotnet new angular" command to generate the project using the terminal in VS Code. From there I use "dotnet run". In the terminal I will get 3 messages: Now listening on: localhost:5001 Now listening on: localhost:5000 and Angular Live Development server listsening on localhost.... This last one changes port number everytime i use the dotnet run command. If i try to access my api on this port i will get a 404 "not found" response in Google Chrome console
– Gilmo
Nov 11 at 23:13





Hi, im just using the "dotnet new angular" command to generate the project using the terminal in VS Code. From there I use "dotnet run". In the terminal I will get 3 messages: Now listening on: localhost:5001 Now listening on: localhost:5000 and Angular Live Development server listsening on localhost.... This last one changes port number everytime i use the dotnet run command. If i try to access my api on this port i will get a 404 "not found" response in Google Chrome console
– Gilmo
Nov 11 at 23:13





1




1




That's because your .NET API is running on localhost:5001, the other port is for @angular/cli
– obl
Nov 12 at 5:15




That's because your .NET API is running on localhost:5001, the other port is for @angular/cli
– obl
Nov 12 at 5:15












Ah ok, I think I understand. At least enough to research a little further anyway. Thanks for pointing me in the right direction.
– Gilmo
Nov 12 at 9:01




Ah ok, I think I understand. At least enough to research a little further anyway. Thanks for pointing me in the right direction.
– Gilmo
Nov 12 at 9:01












So for example in the template, you could call the WeatherForecasts action on the api with https://localhost:5001/api/SampleData/WeatherForecasts
– obl
Nov 12 at 15:15




So for example in the template, you could call the WeatherForecasts action on the api with https://localhost:5001/api/SampleData/WeatherForecasts
– obl
Nov 12 at 15:15

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53215262%2fangular-live-development-server-api-requests-not-found%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53215262%2fangular-live-development-server-api-requests-not-found%23new-answer', 'question_page');

);

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







這個網誌中的熱門文章

Barbados

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3