0

github と nginx から構築された mono 3.2.1 を実行する実稼働サーバーをセットアップしました。すべてが正常に機能しており、通常のサブドメインと、モノサーブされた mvc4 サイトです。また、RAM の使用に関して奇妙な動作に気づいたので、tcp の代わりに UNIX ソケットに切り替えました。

これまでのところ、同じ構成の Windows VPS で使用していたシステム リソースの 10% しか使用していません。

ただし、次のことを試みると 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 で) ページを読み込もうとすると、実装されていないというエラーが表示されます。

このサイトでさまざまなページをモバイルに提供する必要があるため、誰かが私を正しい方向に向けることができます:)

どうもありがとう

デイブ

4

1 に答える 1

1

今はすべて順調です。

それらを DisplayModeProvider に追加する方法を変更しました。

次のようにするとうまくいきます。

DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile")
                                                  {
            ContextCondition = (ctx =>
                                ctx.Request.UserAgent.IndexOf("iPad", StringComparison.OrdinalIgnoreCase) >= 0 ||
                                ctx.Request.UserAgent.IndexOf("iPhone", StringComparison.OrdinalIgnoreCase) >= 0 ||
                                ctx.Request.UserAgent.IndexOf("Windows Phone", StringComparison.OrdinalIgnoreCase) >= 0 ||
                                ctx.Request.UserAgent.Contains("Mobile Safari")||
                                ctx.Request.UserAgent.Contains("Android") &&
                                ctx.Request.UserAgent.IndexOf("Mobile", StringComparison.OrdinalIgnoreCase) <= 0
                                )
        });
于 2013-10-27T13:04:09.810 に答える