我有一个OWIN Web API(控制台应用程序)。使用IntegratedWindowsAuthentication安全保护:
$puja_sam = explode(',', $puja_samagri);
foreach ($puja_sam as $samagri_id){
$samg = $this->crud_model->get_puja_samagri_by_id($samagri_id);
}
foreach ($samg as $row){
?>
我可以使用SOAPUI和NTLM身份验证进行连接。它运作得很好。
当我尝试通过.Net连接时,我得到了401。
/// <summary>
/// This code configures Web API. The Startup class is specified as a type
/// parameter in the WebApp.Start method.
/// </summary>
/// <param name="appBuilder">app builder.</param>
public void Configuration(IAppBuilder appBuilder)
{
// Configure Web API for self-host.
HttpConfiguration config = new HttpConfiguration();
HttpListener listener = (HttpListener)appBuilder.Properties["System.Net.HttpListener"];
listener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
appBuilder.UseWebApi(config);
}
我做错了什么? : - (