无法将ASP.NET MVC + React部署到Azure

我花了将近一天的时间来解决问题,但仍然没有结果。 问题:我创建了一个新的ASP.NET MVC + React项目NET.core 3.0。将其部署到Azure时,出现错误:

public class favaoritesFragment extends Fragment {
        public static TextView data;
        private RecyclerView.Adapter mAdapter;
        private RecyclerView.LayoutManager mLayoutManager;
        @Override
        public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState){
            View view = inflater.inflate(R.layout.fragment_favorites,container,false);
            RecyclerView  mRecyclerView = view.findViewById(R.id.recyclerView);
            mRecyclerView.setHasFixedSize(true);

            mRecyclerView.setLayoutManager(new LinearLayoutManager(getactivity()));

            // remove below line cause in above line you set layoutManager.
            //mRecyclerView.setLayoutManager(mLayoutManager);

            ArrayList<Status> statusArrayList = new ArrayList<>();
            statusArrayList.add(new Status(R.drawable.ic_action_name,"Line2","Line3"));
            statusArrayList.add(new Status(R.drawable.common_google_signin_btn_icon_dark_focused,"Line3"));
            statusArrayList.add(new Status(R.drawable.ic_action_name,"Line3"));

            mAdapter = new RecyclerAdapter(statusArrayList);
            // here you should set adapter to your recycler view after initialize the adapter.
            mRecyclerView.setadapter(mAdapter); 
         return view;
        }

    }

但是,当我创建一个新项目ASP.NET MVC + React项目NET.core 2.2并对其进行部署时,一切正常。因此,我相信问题是NET.core 3.0。 在开发工具->扩展下,我安装了:

HTTP Error 500.30 - ANCM In-Process Start Failure
Common solutions to this issue:
The application failed to start
The application started but then stopped
The application started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265

此外,我在日志中发现该错误

ASP.NET Core 2.2 (x64) Runtime

ASP.NET Core 3.0 (x64) Runtime

ASP.NET Core 3.0 (x86) Runtime

ASP.NET Core Logging Integration

Program.cs:第16行

Application startup exception: System.InvalidOperationException: Key type not specified.
   at microsoft.AspNetCore.Apiauthorization.IdentityServer.ConfigureSigningCredentials.LoadKey()
   at microsoft.AspNetCore.Apiauthorization.IdentityServer.ConfigureSigningCredentials.Configure(ApiauthorizationOptions options)

.....
at microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host,CancellationToken token)
   at microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at ApplicationProcessingApp.Program.Main(String[] args) in C:\Users\Test\Source\Repos\Test\ApplicationProcessingApp\ApplicationProcessingApp\Program.cs:line 16

没有任何效果。我困在那里。我正在寻求社区的帮助。任何建议将不胜感激。 谢谢!

更新: 我将该行添加到appsettings.json中,上面的错误消失了。现在,我的浏览器返回错误500。

        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }
libailiang 回答:无法将ASP.NET MVC + React部署到Azure

因此,答案在最上面。 您必须编辑appsettings.json并像这样使您的IdentityServer

  "IdentityServer": {
    "Key": {
      "Type": "Development"
    },"Clients": {
      "ApplicationProcessingApp": {
        "Profile": "IdentityServerSPA"
      }
    }
  },

我添加了那部分

 "Key": {
      "Type": "Development"
    }
本文链接:https://www.f2er.com/3130390.html

大家都在问