我已经设置了一个运行从 github 和 nginx 构建的 mono 3.2.1 的生产服务器。一切正常,常规子域和我的monoserved mvc4 站点。我还切换到 unix 套接字而不是 tcp,因为我注意到在 ram 使用方面有一些奇怪的行为。
到目前为止 - 我只使用了我在具有相同配置的 windows VPS 上使用的系统资源的 10%,所以 linux 托管的 mvc 就像第一次发现切片面包:D
但是,尝试以下操作时出现 NotImplementedException 错误:
在我的 Global.asax.cs 文件中,在 Application_Start() 下的捆绑设置之后,我正在注册或至少尝试注册检查它是否是移动设备,从而为我的 Index.Mobile.cshtml 服务
像这样
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iphone")
{
ContextCondition = Context =>
Context.Request.Browser["HardwareModel"] == "iPhone"
});
DisplayModeProvider.Instance.Modes.Insert(1, new DefaultDisplayMode("android")
{
ContextCondition = Context =>
Context.Request.Browser["PlatformName"] == "Android"
});
DisplayModeProvider.Instance.Modes.Insert(2, new DefaultDisplayMode("mobile")
{
ContextCondition = Context =>
Context.Request.Browser["IsMobile"] == "True"
});
}
据我发现,在单声道的aspnetwebstack中,有DisplayModeProvider(即)
https://github.com/mono/aspnetwebstack/blob/master/src/System.Web.WebPages/DisplayModeProvider.cs
但是,如果我的 Global.asax.cs 中有这些行,我会在尝试加载页面时收到错误消息(在我的 webconfig 中)
谁能指出我正确的方向,因为我需要这个网站为手机提供不同的页面:)
非常感谢
戴夫