1
我有一個控制器象下面這樣:GUID參數總是空在控制器的ActionResult
public async Task<IHttpActionResult> MyControllerMethod(string currency = null,
string edition = null,
int? systems = null,
string version = null,
Guid? entitlementid = null)
{
//Code here
}
當我從這個URL,執行該控制器:
http://*:*/MyController/MyControllerMethod/?currency=eur&edition=DSSTANDARD&systems=50&version=6.3/
所有的方法的參數具有值如下圖所示:
currency = eur
edition = DSSTANDARD
systems = 50
version = 6.3
但是,如果我做同樣的添加最後一個參數:
...&entitlementid=B5630B37-0820-4EB0-8A2A-000C44885590/
然後,前3個值具有值從URL但entitlementid
總是null
。 可能是什麼問題?
路由配置
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);
http://stackoverflow.com/questions/16605632/mvc-querystring-with-guid-returns-404 –
@KartikeyaKhosla我沒有
eg16
這看起來像一個WebAPI調用。你能顯示路由配置嗎? – Nkosi