コントローラーにメソッドがあります:
public ActionResult SendNotification(Guid? id=null, SendNotification notification =null)
それはに応答します/Apps/SendNotification/{guid}?{SendNotification properties}
SendNotification は、複数の文字列プロパティを持つモデルです。
私の問題は、SendNotification が決して null ではないことです。アクションをどのように呼び出しても、.NET は常に SendNotification のオブジェクトをインスタンス化するようです (すべてのフィールドが null で)。
System.Web.Http.FromUriandでテストしましたが、System.Web.Http.FromBodyそれでも動作します。
何か案は?
注: これは WebApi ではありません。これは通常の MVC です。
私のプロジェクトにはデフォルトルートしかありません:
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);