0

I'm evaluating Windows Azure for an MVC application I'm working on. I ported the app a little while ago and uploading without any issues. I've come back about 4 weeks later to upload the next version and now I'm getting an exception being thrown.

Source: System.Web.WebPages Message: Section not defined: "main". Stack trace: at System.Web.WebPages.WebPageBase.RenderSection(String name, Boolean required) at ASP._Page_Views_Shared__Layout_cshtml.Execute() in e:\sitesroot\0\Views\Shared_Layout.cshtml:line 77 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.WebPages.WebPageBase.RenderSurrounding(String partialViewName, Action`1 body) at System.Web.WebPages.WebPageBase.PopContext() at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c_DisplayClass25.b_22(IAsyncResult asyncResult) at System.Web.Mvc.Controller.<>c_DisplayClass1d.b_18(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.<>c_DisplayClass4.b_3(IAsyncResult ar) at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.<>c_DisplayClass4.b_3(IAsyncResult ar) at System.Web.Mvc.MvcHandler.<>c_DisplayClass6.<>c_DisplayClassb.b_4(IAsyncResult asyncResult) at System.Web.Mvc.Async.AsyncResultWrapper.<>c_DisplayClass4.b__3(IAsyncResult ar) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

The only reason that I can think that this would happening is that either the _layout.cshtml file is not updating or the Home/Index.cshtml file is not updating. The MVC application works correctly both running in the Windows Azure emulator or running stand alone in IIS.

I have completely deleted the role and redeployed as well as upgraded. I have not configured CDN or the Azure Cache and I can confirm files that have been added to the project since the last successful deployment are available.

Right now I'm out of ideas...

EDIT:

I've narrowed the issue down to a call to Html.RenderAction in the sub layout. I'm wondering if this is an issue of it being an MVC 4 project that I'm testing. I have loaded the latest System.Web.Mvc dll as part of my project but whether there's an issue on the Azure servers???

4

2 に答える 2

0

_layout.cshtml内に@RenderSection( "main")があるかどうか知りたいのですが。ある場合は、Index.aspxだけでなく、_layout.cshmlを使用するすべてのページにmainという名前のセクションがあることを確認してください。プロジェクトはローカルで正常に機能するとおっしゃっていましたが、最新バージョンをクラウドにデプロイしていることを確認することをお勧めします。また、ソリューションを再構築し、公開パッケージを削除してから、もう一度パッケージ化して、問題が解決するかどうかを確認してください。

よろしくお願いします、

明徐。

于 2012-04-19T07:19:56.207 に答える
0

問題は解決されました。問題は、RenderActionを介して返される部分的なビューが失敗していたことでした。これは、部分ビューにデータベース呼び出しによって入力された選択リストが含まれていて、データベースへの接続が失敗したためです。Azure上のデータベースはSQLAzureデータベースですが、ローカルではSQL2008R2データベースにすぎません。SQL Azureへのデータベース接続はすでにテスト済みだと思いましたが、明らかにテストしていません。

お時間をいただきありがとうございます明。

于 2012-04-19T14:00:49.060 に答える