我在mvc5控制器中使用webapi方法时出错 [英] Error when I consumed webapi method inside mvc5 controller
本文介绍了我在mvc5控制器中使用webapi方法时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不明白为什么在WebapiUrl之前appand(Institute / MemberLogin?ReturnUrl =)
方法:GET,RequestUri:'http: // localhost:20297 / Institute / MemberLogin?ReturnUrl =%2fapi%2fCoordinatorApi%2fGetDepartmentList%3fInstituteCode%3d4009& InstituteCode = 4009',Version:1.1,Content:< null> ;, Headers:
{
接受:申请/ json
}
我尝试过:
我不知道该怎么做才能解决这个问题。
解决方案
这是回复信息:
{StatusCode:200,ReasonPhrase:'OK',版本:1.1,内容:System.Net.Http.StreamContent,标题:
{
X-Frame-Options:SAMEORIGIN
X-SourceFiles:=?UTF-8?B?RDpcd29ya1xfXFNtc0FwaVxTbXNBcGkuV2ViXGFjY291bnRcbG9naW4 =?=
缓存控制:私有
日期:星期五,2016年6月24日03:04:32 GMT
Set-Cookie:__ Request tVerificationToken = D0tzqAqeERwp2EPr9V0_MYGn0syYsoBeBTS6C28sjPVo436KO837RC_iXZQstD3bqrH5EGKry7gHCFoqvg8ZNpDVDgA1;路径= /; HttpOnly
X-Powered-By:ASP.NET
内容长度:2700
内容类型:text / html; charset = utf-8
}}
请求信息:
AbsoluteUri =http:// localhost:20297 /帐户/登录?ReturnUrl =%2fapi%2fCoordinatorApi%2fGetDepartmentList%3fInstituteCode%3d4009& InstituteCode = 4009
这里帐户/登录?ReturnUrl =添加我的webapi方法为webapi uri添加前缀的原因
i am not understand why appand before WebapiUrl (Institute/MemberLogin?ReturnUrl=)
Method: GET, RequestUri: 'http://localhost:20297/Institute/MemberLogin?ReturnUrl=%2fapi%2fCoordinatorApi%2fGetDepartmentList%3fInstituteCode%3d4009&InstituteCode=4009', Version: 1.1, Content: <null>, Headers: { Accept: application/json }
What I have tried:
I do not not what should i do for solve this issue.
解决方案
This is the response message:
{StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
X-Frame-Options: SAMEORIGIN
X-SourceFiles: =?UTF-8?B?RDpcd29ya1xfXFNtc0FwaVxTbXNBcGkuV2ViXGFjY291bnRcbG9naW4=?=
Cache-Control: private
Date: Fri, 24 Jun 2016 03:04:32 GMT
Set-Cookie: __RequestVerificationToken=D0tzqAqeERwp2EPr9V0_MYGn0syYsoBeBTS6C28sjPVo436KO837RC_iXZQstD3bqrH5EGKry7gHCFoqvg8ZNpDVDgA1; path=/; HttpOnly
X-Powered-By: ASP.NET
Content-Length: 2700
Content-Type: text/html; charset=utf-8
}}
And the request message:
AbsoluteUri = "http://localhost:20297/Account/Login?ReturnUrl=%2fapi%2fCoordinatorApi%2fGetDepartmentList%3fInstituteCode%3d4009&InstituteCode=4009"
HereAccount/Login?ReturnUrl=Add that why my webapi method add prefix with webapi uri.
这篇关于我在mvc5控制器中使用webapi方法时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文