开发者

Azure application working on emulator but not on azure cloud

开发者 https://www.devze.com 2023-02-04 14:32 出处:网络
I am developing my MVC3 application on visual web developer 2010 express, by migrating my MVC3 (cshtml) files on MVC2.

I am developing my MVC3 application on visual web developer 2010 express, by migrating my MVC3 (cshtml) files on MVC2.

It works great on local system using the emulator, but once I deploy the application on azure it gives runtime errors.

Example:

The layout page "~/Views/Shared/test_page.cshtml" could not be found at the following path: "~/Views/Shared/test_page.cshtml". 

Source Error: 


Line 8:          //Layout = "~/开发者_开发百科Views/Shared/upload.cshtml";
Line 9:          //Layout = "~/Views/Shared/_Layout2.cshtml";
Line 10:         Layout = "~/Views/Shared/test_page.cshtml";
Line 11:     }
Line 12:     else

CODE IS AS FOLLOWS:

_ViewStart.cshtml file

@{

    string AccId = Request.QueryString["AccId"].ToString();


    if (AccId=="0")
    {
        //Layout = "~/Views/Shared/upload.cshtml";
        //Layout = "~/Views/Shared/_Layout2.cshtml";
        Layout = "~/Views/Shared/test_page.cshtml";
    }
    else
    {
        string LayOutPagePath = MVCTest.Models.ComponentClass.GetLayOutPagePath(AccId);
        Layout = LayOutPagePath; 
    }



}

.........

however the page exists, and is working fine on azure emulator, but not in azure cloud.

CODE FOR test_page.cshtml

@{

    var result = "1234567890";
    var temp_xml = MVCTest.Models.ComponentClass.GetTemplateAndTheme("1");//returning xml
    string LayOutPagePath = MVCTest.Models.ComponentClass.GetLayOutPagePath("1");//returning string

 }

 @RenderBody()
 <h1>test_page</h1>
 <h4>@temp_xml</h4>
 <h4>@result</h4>
 <h4>@LayOutPagePath</h4>


i found my solution here.. when i create cshtml files on MVC2 i manually change the extension from aspx to cshtml. and the rest you will understand from the link below.

http://blog.andreloker.de/post/2010/07/02/Visual-Studio-default-build-action-for-non-default-file-types.aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号