I have the following situation:
Controller:
[HttpGet]
public async Task<IActionResult> Action()
{
var actionViewModel = new ActionViewModel()
{
ActionOptions = new ActionOptionsViewModel()
}
return View(actionViewModel)
}
View:
@model ActionViewModel
@{ Html.RenderPartial("_ActionOptions", Model.ActionOptions ); }
Partial View:
@model ActionOptionsViewModel
The exception I am getting is:
InvalidOperationException: The model item passed into the ViewDataDictionary is of type 'ActionOptionsViewModel', but this ViewDataDictionary instance requires a model item of type 'ActionViewModel'.
Weirdly enough I get this error only when I get deployed this code on Azure but it works locally. Any ideas why this is happening?! I cant reproduce the error on localhost and cant figure out what possible could be different when it comes to rendering a view on localhost and Azure...