Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.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
Asp.net mvc Asp.net Web API 2和使用集成Windows和基于令牌的混合身份验证_Asp.net Mvc_Asp.net Web Api_Oauth 2.0_Asp.net Web Api2_Owin Middleware - Fatal编程技术网

Asp.net mvc Asp.net Web API 2和使用集成Windows和基于令牌的混合身份验证

Asp.net mvc Asp.net Web API 2和使用集成Windows和基于令牌的混合身份验证,asp.net-mvc,asp.net-web-api,oauth-2.0,asp.net-web-api2,owin-middleware,Asp.net Mvc,Asp.net Web Api,Oauth 2.0,Asp.net Web Api2,Owin Middleware,我有一个在IIS下运行的asp.net Web API服务器,到目前为止,它一直使用windows身份验证,因为它只有其他服务运行在与它连接的同一个域上 因此,在我的web.config中,我有以下设置 <system.web> <compilation debug="true" targetFramework="4.5.1" /> <httpRuntime targetFramework="4.5.1" /> <authent

我有一个在IIS下运行的asp.net Web API服务器,到目前为止,它一直使用windows身份验证,因为它只有其他服务运行在与它连接的同一个域上

因此,在我的web.config中,我有以下设置

 <system.web>
    <compilation debug="true" targetFramework="4.5.1" />
    <httpRuntime targetFramework="4.5.1" />
    <authentication mode="Windows" />
  </system.web>

 <system.webServer>
  <security>
    <authentication>     
       <windowsAuthentication enabled="true" />
    </authentication>
  </security>
   ....

,到目前为止,要使用它,我需要在我的
web.config
中关闭Windows身份验证才能使用它。如果我像上面那样离开windows配置,我甚至不会在我(例如,se Postman)调用没有windows身份验证设置的路由时调用任何Owin中间方法(或自定义筛选器)

所以我的问题是

  • 我如何允许任何一种身份验证,以便即使是浏览器(在同一域上)也可以调用路由并进行身份验证(通过协商),但也允许其他客户端使用基于令牌的方案(非常重要)如何在
    web.config
    中配置这两种功能

提前感谢您的帮助

“我也面临着类似的情况,你有没有让它工作过?”马蒂失望地问,“没有,我仍然没有让它工作,但我仍然想完成它。”。目前,如果我需要混合模式,我需要两个应用程序实例,这是非常蹩脚的。