<legend id='3mZgE'><style id='3mZgE'><dir id='3mZgE'><q id='3mZgE'></q></dir></style></legend>

    1. <small id='3mZgE'></small><noframes id='3mZgE'>

      <tfoot id='3mZgE'></tfoot>

      1. <i id='3mZgE'><tr id='3mZgE'><dt id='3mZgE'><q id='3mZgE'><span id='3mZgE'><b id='3mZgE'><form id='3mZgE'><ins id='3mZgE'></ins><ul id='3mZgE'></ul><sub id='3mZgE'></sub></form><legend id='3mZgE'></legend><bdo id='3mZgE'><pre id='3mZgE'><center id='3mZgE'></center></pre></bdo></b><th id='3mZgE'></th></span></q></dt></tr></i><div id='3mZgE'><tfoot id='3mZgE'></tfoot><dl id='3mZgE'><fieldset id='3mZgE'></fieldset></dl></div>

          <bdo id='3mZgE'></bdo><ul id='3mZgE'></ul>

        即使允许几乎所有内容,ASP.NET 5/Core/vNext CORS 也无法正常工作

        ASP.NET 5/Core/vNext CORS not working even if allowing pretty much everything(即使允许几乎所有内容,ASP.NET 5/Core/vNext CORS 也无法正常工作)
      2. <small id='DbaZD'></small><noframes id='DbaZD'>

        <legend id='DbaZD'><style id='DbaZD'><dir id='DbaZD'><q id='DbaZD'></q></dir></style></legend>

            <i id='DbaZD'><tr id='DbaZD'><dt id='DbaZD'><q id='DbaZD'><span id='DbaZD'><b id='DbaZD'><form id='DbaZD'><ins id='DbaZD'></ins><ul id='DbaZD'></ul><sub id='DbaZD'></sub></form><legend id='DbaZD'></legend><bdo id='DbaZD'><pre id='DbaZD'><center id='DbaZD'></center></pre></bdo></b><th id='DbaZD'></th></span></q></dt></tr></i><div id='DbaZD'><tfoot id='DbaZD'></tfoot><dl id='DbaZD'><fieldset id='DbaZD'></fieldset></dl></div>

              <tbody id='DbaZD'></tbody>
                <tfoot id='DbaZD'></tfoot>
                  <bdo id='DbaZD'></bdo><ul id='DbaZD'></ul>

                  本文介绍了即使允许几乎所有内容,ASP.NET 5/Core/vNext CORS 也无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 ASP.NET 5 Web API(好吧,无论如何现在都是 MVC)后端,我正在使用

                • 对于实际的 POST 请求(这个没有通过):
                • 解决方案

                  问题实际上在于处理 POST 请求的操作中存在异常,正如 Norgerman 所说,默认异常处理程序清除了 CORS 标头.

                  I have a ASP.NET 5 Web API (Well, MVC now anyway) back-end which I am consuming in with the axios library in my JS app.

                  My CORS config in MVC is the following:

                  public void ConfigureServices(IServiceCollection services)
                  {
                        services.AddMvc();
                        services.AddCors();
                  } 
                  
                  
                  public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
                  { 
                        app.UseCors(builder => {
                            builder.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader();
                        });
                  }
                  

                  So in other words, I should be allowing every request possible. However, while this fixed preflight requests, a POST requests still gets rejected (I can see it executes on the server, but there's no header in the response so it results in a client side error).

                  Does anyone have any ideas why this wouldn't work ?

                  These are the headers that are returned by the MVC api:

                  • For the OPTIONS preflight (this one passes):
                  • For the actual POST request (this one does NOT pass):

                  解决方案

                  The problem was actually in the fact that there was an exception in the action processing the POST request and as Norgerman mentioned, the default exception handler cleared the CORS headers.

                  这篇关于即使允许几乎所有内容,ASP.NET 5/Core/vNext CORS 也无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  C# namespace alias - what#39;s the point?(C# 命名空间别名 - 有什么意义?)
                  Using Xpath With Default Namespace in C#(在 C# 中使用具有默认命名空间的 Xpath)
                  Generating an EDMX from a DB2 Database(从 DB2 数据库生成 EDMX)
                  IBM .NET Data Provider Connection String issue with Library List(库列表的 IBM .NET 数据提供程序连接字符串问题)
                  .NET DB2 OLEDB pre-requisites(.NET DB2 OLEDB 先决条件)
                  Referring to Code in IBM.Data.DB2 makes that Assembly Unavailable to the rest of my Solution(引用 IBM.Data.DB2 中的代码使该程序集对我的解决方案的其余部分不可用)
                    <bdo id='iHj82'></bdo><ul id='iHj82'></ul>

                          <tfoot id='iHj82'></tfoot>
                          <i id='iHj82'><tr id='iHj82'><dt id='iHj82'><q id='iHj82'><span id='iHj82'><b id='iHj82'><form id='iHj82'><ins id='iHj82'></ins><ul id='iHj82'></ul><sub id='iHj82'></sub></form><legend id='iHj82'></legend><bdo id='iHj82'><pre id='iHj82'><center id='iHj82'></center></pre></bdo></b><th id='iHj82'></th></span></q></dt></tr></i><div id='iHj82'><tfoot id='iHj82'></tfoot><dl id='iHj82'><fieldset id='iHj82'></fieldset></dl></div>
                        • <legend id='iHj82'><style id='iHj82'><dir id='iHj82'><q id='iHj82'></q></dir></style></legend>
                            <tbody id='iHj82'></tbody>

                          <small id='iHj82'></small><noframes id='iHj82'>