2017-06-19 16 views
0

私の学校の新しいプロジェクトに取り組んでいます.Windows Server 2012 r2のIIS 8でASP.Net MVCに自分のウェブサイトを公開しようとしています。'/'アプリケーションのサーバーエラー。 withビュー

私のプロジェクトはFramework .net 4.5.2です。

Server Error in '/' Application. 

    The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: 
    ~/Views/Home/Index.aspx 
    ~/Views/Home/Index.ascx 
    ~/Views/Shared/Index.aspx 
    ~/Views/Shared/Index.ascx 
    ~/Views/Home/Index.cshtml 
    ~/Views/Home/Index.vbhtml 
    ~/Views/Shared/Index.cshtml 
    ~/Views/Shared/Index.vbhtml 
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: 
    ~/Views/Home/Index.aspx 
    ~/Views/Home/Index.ascx 
    ~/Views/Shared/Index.aspx 
    ~/Views/Shared/Index.ascx 
    ~/Views/Home/Index.cshtml 
    ~/Views/Home/Index.vbhtml 
    ~/Views/Shared/Index.cshtml 
    ~/Views/Shared/Index.vbhtml 

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

そして、私はこれも持っている:私はフレームワークの.NET V4.5ですべてを試してみた

Stack Trace: 


    [InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: 
    ~/Views/Home/Index.aspx 
    ~/Views/Home/Index.ascx 
    ~/Views/Shared/Index.aspx 
    ~/Views/Shared/Index.ascx 
    ~/Views/Home/Index.cshtml 
    ~/Views/Home/Index.vbhtml 
    ~/Views/Shared/Index.cshtml 
    ~/Views/Shared/Index.vbhtml] 

    System.Web.Mvc.ViewResult.FindView(ControllerContext context) +499 
    System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +143 

    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +88 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) +831 
    System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +81 
    System.Web.Mvc.Async.<>c__DisplayClass21. 
    <BeginInvokeAction>b__1e(IAsyncResult asyncResult) +185 
    System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38 
    System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +67 
    System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36 
    System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38 
    System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43 
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +67 
    System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38 
    System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +607 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +134 

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2053.0 

私はこのエラーを持っているIISの私のウェブサイトを起動しよう

または私のプロジェクトのために、私のアプリケーションプールの4.5.2:

.NET v2.0 (version v2.0 and v4.0.39319 of CLR.NET) 
    .NET v2.0 Classic (version v2.0.50727 of CLR.NET and v4.0.39319 of CLR.NET) 
    .NET v4.5 (version v4.0.39319 of CLR.NET and v2.0.50727 of CLR.NET) 
    .NET v4.5 Classic v4.0.39319 of CLR.NET and v2.0.50727 of CLR.NET) 
    Classic .NET AppPool (version v4.0.39319 of CLR.NET and v2.0.50727 of CLR.NET) 
    DefaultAppPool (version v4.0.39319 of CLR.NET and v2.0.50727 of CLR.NET) 

UPDATE: まず、あなたの答えに感謝します。

私はMVCを使用していますが、私はコントローラを作成し、このコントローラではデフォルトでビューの作成を使用しました。私は彼らの名前や何かを変えていない。ちょうどそれにいくつかのコードを入れてください。残りのVisual Studioコミュニティ2015

とよく私のプロジェクトの作業は、私のビュー]フォルダは、このようなものです:

--> Views 
    --> Home 
     --> About.cshtml 
     --> Contact.cshtml 
     --> Legal.cshtml (not used) 
    --> Participants 
     --> Create.cshtml 
     --> Index.cshtml 
    --> Shared 
     --> _Layout.cshtml 
     --> Error.cshtml 

もう一つは、私がのinetpub「で私のフォルダを入れているということです - > wwwrootに - > MyFolder。私はIUSRとIIS_IUSRSの読み取りと実行の権利を追加しました。私は既に完全コントロールに変更しようとしました。

これはASP.NET MVCでIISに追加する最初のプロジェクトではありません。しかし、これについては何が問題なのか分かりません...

y私は週の終わりの前に、このウェブサイトを公開する必要があるため、OUは、この答えは、実際にStackOverflowの価値があるべきではないです...事前に

おかげで、

Mattexis

+0

あなたは間違いなく「Views/Home/Index。***」というフォルダを持っていますか?間違いなく出版されましたか?あなたのフォルダ構造は何ですか? – Jonesopolis

+4

「ここでファイルを見つけることができません」と表示されたら、実際にファイルが存在し、2)そのファイルにアクセスしようとするアカウントに読み取り権限がありますそれを実行する)。 – Will

+0

私はページの下にもっと多くの情報を入れましたが、はい、私はこのフォルダとこのファイルを持っています。ありがとう – Mattexis

答えて

0

を私を助けることができます。..しかし、私はあなたが実際に何がmvcであり、どのようにこれをチェックする必要があるかを理解していないと推測しています。link

とにかくこの問題については、私はあなたが以下のようなあなたのコントローラ内のアクションを追加していると信じて:

public ActionResult Index() 
{ 
    return View(); 
} 

あなたは右Indexをクリックして、ビューを作成することができます、あなたはそれが名前だ変更した場合作成]ダイアログでは、それは、ビューに名前を付けることが求められますあなたがそれを変更したりしていないかどうかがわからない場合、あなたは簡単にだけreturn View();

アクションとしての同じ名前が今、ここにどのようにですが

public ActionResult Index() 
{ 
    return View("Changed"); 
} 

:あなたは次のように表示名を返す必要がありますあなたはこれをチェックすることができます:

コントローラを作成すると、コントローラと同じ名前のフォルダがビューフォルダ内に作成されます。 HomeControllerを作成すると、Viewフォルダ内にHomeフォルダも作成されます。このフォルダを開くファイルの名前は何ですか、またはそこにファイルがありますか?

コントローラー内のアクションからビューを呼び出す場合、ビューはコントローラーと同じフォルダーまたは共有フォルダーにある必要があります。そうでない場合は上記のエラーが表示されます。

更新:あなたがファイルにアクセスしようとしたアカウント読み取り権限を持っていることを確認する必要があり、サーバ上でアプリケーションを実行している場合@Willは、言及したとしても

関連する問題