Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 为什么asp.net core 3.0应用程序只有在刷新浏览器后才会出现?_Reactjs_Asp.net Core_Visual Studio 2019 - Fatal编程技术网

Reactjs 为什么asp.net core 3.0应用程序只有在刷新浏览器后才会出现?

Reactjs 为什么asp.net core 3.0应用程序只有在刷新浏览器后才会出现?,reactjs,asp.net-core,visual-studio-2019,Reactjs,Asp.net Core,Visual Studio 2019,我将.net core 2.2.js应用程序升级为.net core 3.0。我正在Visual Studio 2019中运行它。我得到以下错误: System.Net.Http.HttpRequestException: Failed to proxy the request to http://localhost:51719/, because the request to the proxy target failed. 如果我刷新加载页面,它可以正常加载。为什么加载速度慢或出错?要缩短

我将.net core 2.2.js应用程序升级为.net core 3.0。我正在Visual Studio 2019中运行它。我得到以下错误:

System.Net.Http.HttpRequestException: Failed to proxy the request to http://localhost:51719/, because the request to the proxy target failed.
如果我刷新加载页面,它可以正常加载。为什么加载速度慢或出错?

要缩短加载速度:

Angular CLI过程需要一些时间来构建项目。如果正在命令行中运行
npm start
,请等待它完成,然后使用
F5

有些人为此找到了解决办法: 试着注释掉这行:

spa.useProxytosPadDevelopmentServer(“http://localhost:4200");

startup.cs
文件中使用

spa.UseAngularCliServer(npmScript:“启动”)


希望这对您有意义。

spa应用程序的启动通常需要一些时间,如果达到超时,您将收到一个错误

您可以通过
UseSpa()

app.UseSpa(spa =>
{
    spa.Options.StartupTimeout = TimeSpan.FromMinutes(5);
    spa.Options.SourcePath = "ClientApp";

    if (env.IsDevelopment())
    {
        spa.UseReactDevelopmentServer(npmScript: "start");
    }
});