2009-08-08 6 views
1

私はこのtutorialを調べています。だから私はそれを通過し、サンプルファイルをダウンロードしました。私はXvalとリモートバリデーションで間違っていることを確信していません

私はそれを使って遊んでいました。私はそれをどのように使用するのかを理解しており、独自の検証も追加できました。

私はそれを私が取り組んでいる私の現在のプロジェクトに加えることに決めました。私はそれをコンパイルして、まだ私が自分のフォームを試してみると(クライアント側とサーバー側の両方の)検証は行われませんでした。

なぜわからないのですか?だから私は別のプロジェクトを作って、すべてのものをもう一度追加しようとしましたが、私はそれがうまくいかないことは分かりません。

あなたは、これは私があなたの周りのコードをコピー&ペーストするにはあまりにも多くのファイルを彼らに示すことができる唯一の現実的な方法であるhere

それをダウンロードすることができます。

私のテストではまだリモート検証部分を使用していません。私が持っていたことの1つが「必須のメール」のように、xvalのストレートなものだけを使用しています。

おかげ

編集は、今私は

System.IO.FileNotFoundException was unhandled by user code 
    Message="Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=99.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified." 
    Source="Online.com" 
    FileName="System.ComponentModel.DataAnnotations, Version=99.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" 
    FusionLog="=== Pre-bind state information ===\r\nLOG: User = CHOBO2\\chobo\r\nLOG: DisplayName = System.ComponentModel.DataAnnotations, Version=99.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\n (Fully-specified)\r\nLOG: Appbase = file:///I:/OnlineV2/trunk/Current Site/\r\nLOG: Initial PrivatePath = I:\\OnlineV2\\trunk\\Current Site\\bin\r\nCalling assembly : Online.com, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.\r\n===\r\nLOG: This bind starts in default load context.\r\nLOG: Using application configuration file: I:\\OnlineV2\\trunk\\Current Site\\web.config\r\nLOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config.\r\nLOG: Post-policy reference: System.ComponentModel.DataAnnotations, Version=99.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\r\nLOG: The same bind was seen before, and was failed with hr = 0x80070002.\r\n" 
    StackTrace: 
     at Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder.GetTypeDescriptor(Object model, Type modelType) 
     at Microsoft.Web.Mvc.DataAnnotations.DataAnnotationsModelBinder.GetModelProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) in I:\OnlineV2\trunk\Current Site\Models\DataAnnotationsModelBinder\DataAnnotationsModelBinder.cs:line 35 
     at System.Web.Mvc.DefaultModelBinder.BindProperties(ControllerContext controllerContext, ModelBindingContext bindingContext) 
     at System.Web.Mvc.DefaultModelBinder.BindComplexElementalModel(ControllerContext controllerContext, ModelBindingContext bindingContext, Object model) 
     at System.Web.Mvc.DefaultModelBinder.BindComplexModel(ControllerContext controllerContext, ModelBindingContext bindingContext) 
     at System.Web.Mvc.DefaultModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) 
     at System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) 
     at System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) 
     at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) 
    InnerException: 

答えて

0

私も同様の問題がありました。私はData Annotations Model Binder Sampleをダウンロードし、ビルドして、私のプロジェクトで新しいアセンブリを参照しました。魅力のように働いた。

0

エラーを取得し、あなたが密接に読み込みエラーがありますか?ファイルが見つからないようです。私はそれがコンパイルされることにも驚いていますが、ファイルの参照についてはあまりよく分かりません。このエラーはテストボックスにあり、別のマシンに公開した後ではありません。

私はあなたの参照から削除し、それを再度追加することから始めます。

明らかに、DataAnnotationsには.NET 3.5SP1が必要ですが、わずかに最新のものであってもその必要があります。

+0

私はエラーを読みました。私はどこにあるのか知っています。何も移動されていないので、パスは100%正しいです。私は私のbinディレクトリ内のカスタムフォルダにそれを持っていましたが、それを理解しました。 xValはbin rootの下でそれを直接どこでも使用したいと思うようです。 – chobo2

関連する問題