Curl Thinktecture IdentityModel获取会话令牌

Curl Thinktecture IdentityModel获取会话令牌,curl,asp.net-web-api,thinktecture-ident-model,Curl,Asp.net Web Api,Thinktecture Ident Model,使用Thinktecture IdentityModel获取会话令牌的方法是。但我在使用浏览器以及以下代码时收到错误“响应状态代码不表示成功:404(未找到)。” var credentials = new NetworkCredential("admin", "password"); var handler = new HttpClientHandler { Credentials = credentials }; var client = new HttpClient(handler) {B

使用Thinktecture IdentityModel获取会话令牌的方法是。但我在使用浏览器以及以下代码时收到错误“响应状态代码不表示成功:404(未找到)。”

var credentials = new NetworkCredential("admin", "password");
var handler = new HttpClientHandler { Credentials = credentials };
var client = new HttpClient(handler) {BaseAddress = new Uri("http://www.website.com/")};

var response = await client.GetAsync("api/token");
response.EnsureSuccessStatusCode(); // Throw on error code.
var accountInformationJson = await response.Content.ReadAsStringAsync();
但是当我尝试使用CURL时 curl--用户管理员:密码--获取

我好像恢复得很好 { “访问令牌”:“HFSDHFHFJHFHDS8F9JSDHR9843HRF.shf789qy34rjhf9awyfw8ehf…”, “到期日”:36000.0 }

知道为什么会发生这种情况吗?

我不得不打电话来获取会话令牌