Is it possible to use UseProxyToSpaDevelopmentServer from inside of local service fabric cluster?
up vote
0
down vote
favorite
I was trying to use UseProxyToSpaDevelopmentServer option from inside of local service fabric cluster and I got no results. I literally didn't get any requests from server, when I was trying to access SPA application by route http://localhost:9000/UI/. I'm using asp.net core 2.1 angular template. I use Razor to create an initial Angular page.
My Startup class looks like:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200/");
}
});
}
I'm running application in development mode for sure.
I tried to get any request by launching basic node js server as well as angular app with ng serve command, but as I said got no results.
angular asp.net-core-2.1
add a comment |
up vote
0
down vote
favorite
I was trying to use UseProxyToSpaDevelopmentServer option from inside of local service fabric cluster and I got no results. I literally didn't get any requests from server, when I was trying to access SPA application by route http://localhost:9000/UI/. I'm using asp.net core 2.1 angular template. I use Razor to create an initial Angular page.
My Startup class looks like:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200/");
}
});
}
I'm running application in development mode for sure.
I tried to get any request by launching basic node js server as well as angular app with ng serve command, but as I said got no results.
angular asp.net-core-2.1
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I was trying to use UseProxyToSpaDevelopmentServer option from inside of local service fabric cluster and I got no results. I literally didn't get any requests from server, when I was trying to access SPA application by route http://localhost:9000/UI/. I'm using asp.net core 2.1 angular template. I use Razor to create an initial Angular page.
My Startup class looks like:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200/");
}
});
}
I'm running application in development mode for sure.
I tried to get any request by launching basic node js server as well as angular app with ng serve command, but as I said got no results.
angular asp.net-core-2.1
I was trying to use UseProxyToSpaDevelopmentServer option from inside of local service fabric cluster and I got no results. I literally didn't get any requests from server, when I was trying to access SPA application by route http://localhost:9000/UI/. I'm using asp.net core 2.1 angular template. I use Razor to create an initial Angular page.
My Startup class looks like:
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
}
app.UseStaticFiles();
app.UseSpaStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller}/{action=Index}/{id?}");
});
app.UseSpa(spa =>
{
// To learn more about options for serving an Angular SPA from ASP.NET Core,
// see https://go.microsoft.com/fwlink/?linkid=864501
spa.Options.SourcePath = "ClientApp";
if (env.IsDevelopment())
{
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200/");
}
});
}
I'm running application in development mode for sure.
I tried to get any request by launching basic node js server as well as angular app with ng serve command, but as I said got no results.
angular asp.net-core-2.1
angular asp.net-core-2.1
asked Nov 19 at 20:47
A. Tretiakov
112
112
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
I actually figured it out. The problem is app.UseSpa is coming after app.UseMvc. Since my razor page has been called Index.cshtml, MVC is taking over Spa requests.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
I actually figured it out. The problem is app.UseSpa is coming after app.UseMvc. Since my razor page has been called Index.cshtml, MVC is taking over Spa requests.
add a comment |
up vote
1
down vote
accepted
I actually figured it out. The problem is app.UseSpa is coming after app.UseMvc. Since my razor page has been called Index.cshtml, MVC is taking over Spa requests.
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
I actually figured it out. The problem is app.UseSpa is coming after app.UseMvc. Since my razor page has been called Index.cshtml, MVC is taking over Spa requests.
I actually figured it out. The problem is app.UseSpa is coming after app.UseMvc. Since my razor page has been called Index.cshtml, MVC is taking over Spa requests.
answered Nov 19 at 21:15
A. Tretiakov
112
112
add a comment |
add a comment |
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%2f53382395%2fis-it-possible-to-use-useproxytospadevelopmentserver-from-inside-of-local-servic%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