Apo*_*nos 9 asp.net-mvc mono action xamarin
我有这些行动:
public class HomeController : Controller
{
public ActionResult Index ()
{
ViewData ["Message"] = "Welcome to ASP.NET MVC on Mono!";
return View ();
}
public ActionResult Pages (string test)
{
ViewBag.Message = test;
return View ();
}
}
Run Code Online (Sandbox Code Playgroud)
页面操作无效.我收到错误500:
System.TypeLoadException
Could not load type 'System.Web.UnvalidatedRequestValuesBase' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
Description: HTTP 500.Error processing request.
Details: Non-web exception. Exception origin (name of application or object): System.Web.Mvc.
Exception stack trace:
at System.Web.Mvc.FormValueProviderFactory.GetValueProvider (System.Web.Mvc.ControllerContext controllerContext) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ValueProviderFactoryCollection.GetValueProvider (System.Web.Mvc.ControllerContext controllerContext) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerBase.get_ValueProvider () [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.GetParameterValue (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ParameterDescriptor parameterDescriptor) [0x00000] in <filename unknown>:0 at System.Web.Mvc.ControllerActionInvoker.GetParameterValues (System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ActionDescriptor actionDescriptor) [0x00000] in <filename unknown>:0 at System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass21.<BeginInvokeAction>b__19 (System.AsyncCallback asyncCallback, System.Object asyncState) [0x00000] in <filename unknown>:0
Run Code Online (Sandbox Code Playgroud)
如果我从该操作中删除参数工作正常.
有任何想法吗?
提前致谢!
ps我还没有定义任何路线.
使用最新的单声道(3.6.1)无法解决问题. 有用的是: 如果您使用的是5.X NuGet Microsoft ASP.NET MVC软件包,则需要降级到MVC 4.
System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc
在/Views/Web.Config中factoryType
的属性host
节点4.0.0.0.所以行看起来像这样:<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
webpages:Version
在根目录/ Web.Config中更改为2.0.0.0,如下所示:
<add key=”webpages:Version” value=”2.0.0.0” />
然后,您可以在控制器操作中使用参数.
归档时间: |
|
查看次数: |
2996 次 |
最近记录: |