1

こんにちは、私は自分のウェブサイトをモノ (ubuntu サーバー上) で実行しようとしており、これらのチュートリアルをほぼ文字どおり実行しました。

ただし、私のディレクトリが空白でない場合、fastcgi ログはこれを明らかにします:

    Notice  Beginning to receive records on connection.
    Error   Failed to process connection. Reason: Exception has been thrown by the target of an invocation.

これが何を意味するのかよくわかりません。何をするかによっては、リソースが見つからないことを示す別のエラーが発生する可能性があります。

リソースが見つかりません。

    Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.   Please review the following URL and make sure that it is spelled correctly.

要求された URL: /Default.aspx/ バージョン情報: Mono ランタイム バージョン: 2.10.8 (tarball Thu Aug 16 23:46:03 UTC 2012) ASP.NET バージョン: 4.0.30319.1

さらに情報を提供する必要がある場合は、お知らせください。

編集:

現在、nginx ゲートウェイ エラーが発生しています。

私のnginx構成ファイルは次のようになります。

server {
    listen   2194;
    server_name localhost;
    access_log $HOME/WWW/nginx.log;

    location / {
      root $HOME/WWW/dev/;
      index index.html index.html default.aspx Default.aspx Index.cshtml;
      fastcgi_index Views/Home/; 
      fastcgi_pass 127.0.0.1:8000;
      include /etc/nginx/fastcgi_params;
    }
}

すべてを xsp4 で実行すると、「呼び出しのターゲットによって例外がスローされた」ことがわかりました。

例外の種類の処理 TargetInvocationException メッセージは、呼び出しのターゲットによって例外がスローされました。IsTerminating が True に設定されている System.Reflection.TargetInvocationException: 呼び出しのターゲットによって例外がスローされました。

サーバー スタック トレース: System.Reflection.MonoCMethod.Invoke (System.Object obj、BindingFlags invokeAttr、
System.Reflection.Binder バインダー、System.Object[] パラメーター、
System.Globalization.CultureInfo カルチャ) [0x00000] in :0 at System .Reflection.MethodBase.Invoke (System.Object obj、System.Object[] パラメーター) [0x00000] in :0
at System.Runtime.Serialization.ObjectRecord.LoadData (System.Runtime.Serialization.ObjectManager マネージャー、ISurrogateSelector セレクター、StreamingContext コンテキスト) ) [0x00000] in :0 at System.Runtime.Serialization.ObjectManager.DoFixups () [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadNextObject (System.IO.BinaryReader リーダー) [0x00000] :0 で
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ReadObjectGraph (BinaryElement elem、System.IO.BinaryReader リーダー、ブール値の readHeaders、System.Object& 結果、System.Runtime.Remoting.Messaging.Header[]& ヘッダー) で [0x00000] in :0 at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.NoCheckDeserialize (System.IO.Stream serializationStream、System.Runtime.Remoting.Messaging.HeaderHandler ハンドラ) [0x00000] in :0 at System.Runtime.Serialization.Formatters .Binary.BinaryFormatter.Deserialize (System.IO.Stream serializationStream) [0x00000] in :0 at System.Runtime.Remoting.RemotingServices.DeserializeCallData (System.Byte[] array) [0x00000] in :0 at (wrapper xdomain-dispatch ) System.AppDomain:DoCallBack (オブジェクト、バイト[]&、バイト[]&)

[0] で例外が再スローされました: ---> System.ArgumentException: メソッド 'SetHostingEnvironment' にバインドできませんでした。System.Delegate.GetCandidateMethod (System.Type 型、System.Type ターゲット、System.String メソッド、BindingFlags bflags、ブール値の ignoreCase、ブール値の throwOnBindFailure) [0x00000] で:0 で System.Delegate.CreateDelegate (System.Type 型、システム.Type ターゲット、System.String メソッド、Boolean ignoreCase、Boolean throwOnBindFailure) [0x00000] in :0 at System.Delegate.CreateDelegate (System.Type タイプ、System.Type ターゲット、System.String メソッド) [0x00000] in :0 at System.DelegateSerializationHolder+DelegateEntry.DeserializeDelegate (System.Runtime.Serialization.SerializationInfo 情報) [0x00000] in :0 at System.DelegateSerializationHolder..ctor (System.Runtime.Serialization.SerializationInfo 情報、
(ラッパー xdomain-invoke) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) at (ラッパー remoting-invoke-with-check) System.AppDomain:DoCallBack (System.CrossAppDomainDelegate) at System.Web.Hosting.ApplicationHost.CreateApplicationHost (システム.Type hostType, System.String virtualDir, System.String physicalDir) [0x00000] in :0 at Mono.WebServer.VPathToHost.CreateHost (Mono.WebServer.ApplicationServer サーバー、Mono.WebServer.WebSource webSource) [0x00000] in :0 at Mono.WebServer.XSP.Server.RealMain (System.String[] args, Boolean root, IApplicationHost ext_apphost, Boolean quiet) [0x00000] in :0 at Mono.WebServer.XSP.Server.Main (System.String[] args) [0x00000] in :0

4

2 に答える 2

3

あなたのnginx設定で、これを行います

fastcgi_index   /;

これの代わりに:

fastcgi_index Default.aspx;

そしてこれの代わりに:

fastcgi_index Views/Home/;

モノ fastcgi サーバーがベース リクエストを確認できるようにします。mvc3-land では、すべてがルート経由で行われるため、Default.aspx はありません。したがって、次の行も削除します。

index index.html index.html default.aspx Default.aspx Index.cshtml;

もう 1 つの問題は、プロジェクトが参照しているライブラリでコンパイルされたランタイム 2 .dll へのアセンブリ参照が基になっていることです。

nuget からの nhibernate 参照が実際には 3.5 .dll であることがわかったとき、私はこれを自分で発見しました。これにより、ライブラリ内で一部のタイプのみをロードでき、他のタイプは実際に起こっていることに関係のないクレイジーな例外をスローするようになりました。csharp コンソールを使用してこれを見つけました。

根本的な問題に私を手がかりにした最初の例外はこれでした:

System.TypeLoadException: Could not load type
    at (wrapper managed-to-native) System.Type:type_is_assignable_from (System.Type,System.Type)
于 2012-09-01T03:30:45.023 に答える
0

404 URL は「/Default.aspx/」です。

/ 最後にディレクトリを探しているので、代わりに Default.aspx ファイルを探してほしいと思いますか?

fastcgi 接続用の nginx 構成ブロックはどのように見えますか?

更新(要求された情報が追加された後):

http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_indexでは、fastcgi_index ディレクティブについて説明しています。Views/Home/ を任意のダイレコリーの $fastcgi_script_name に追加する方法は、ちょっと奇妙です。

おそらく、fastcgi_index を Default.aspx に設定することをお勧めします (これにより、ディレクトリに対するすべての要求が directory/default.aspx として渡されます。これが必要だと思います)。

また、実行するファイルを知るために mono がおそらく使用する script_filename も設定していません (これは、どの場合でも php/ruby fastcgi で動作する方法です)。

ロケーションブロックのnginxパラメータには、おそらく次のようなものが必要です。

fastcgi_index Default.aspx;
fastcgi_param SCRIPT_FILENAME $HOME/WWW/dev/home/$fastcgi_script_name;
fastcgi_pass 127.0.0.1:8000;
include /etc/nginx/fastcgi_params;

(チュートリアルを正しく読めば、SCRIPT_FILENAME はおそらく $fastcgi_script_name になる可能性があります)

余談ですが、通常はサーバー ブロック レベルで一度インデックスとルート ディレクティブを設定するので、ロケーション ブロックごとに繰り返す必要はありません。

于 2012-08-19T20:55:53.420 に答える