Razor视图在本地工作,但不在Azure Web应用程序中

时间:2017-10-06 08:00:20

标签: c# asp.net-mvc azure asp.net-mvc-4 razor

我有一个奇怪的问题。我有一个页面,其中包含以下网址:#include <iostream> #include <stdlib.h> using namespace std; int main(int argc, char *argv[]) { // Variabili int n; cout<<"Inserisci il numero di volte che vuoi ripetere la stringa Hello World!:"; cin>>n; cout<<"Hai deciso di ripetere la stringa"<<" "<<n<<" "<<"volte"; // Ciclo While che ripete la stringa n volte while() { cout << "Hello World!" << endl; } system("PAUSE"); return 0; } 。当我在本地进入此页面并且我在Visual Studio 中运行时,但是当我在线输入时,我得到以下错误

/ShowLead?leadid=3&customerid=9626

它作为完全标准的Azure Web应用程序托管。

这对我来说很奇怪,因为如果我们查看我的文件夹结构,我会在The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched: ~/Views/ShowLead/Index.aspx ~/Views/ShowLead/Index.ascx ~/Views/Shared/Index.aspx ~/Views/Shared/Index.ascx ~/Views/ShowLead/Index.cshtml ~/Views/ShowLead/Index.vbhtml ~/Views/Shared/Index.cshtml ~/Views/Shared/Index.vbhtml Description: An unhandled exception occurred during the execution of the current web req 处有一个Razor视图:

enter image description here

我的控制器看起来像这样:

~/Views/ShowLead/Index.cshtml

视图本身是:

public class ShowLeadController : Controller
{

    // GET: ShowLead
    public ActionResult Index(int leadid, int customerid)
    {
        // some amazing code that creates my viewmodel

        return View(vm);
    }   
 }

我认为问题是@model Asano.Websites.LeadSender.Models.ViewModels.ShowLeadViewModel @{ Layout = null; } <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body style="padding-top: 20px; font-family: Helvetica"> <div style="margin:25px;"> // some of the best HTML the world has ever seen with inline styles </div> </body> </html> ,但我想要的是这个视图不使用master,而是像这样的vanila页面。

1 个答案:

答案 0 :(得分:1)

您确定此视图已包含在您的项目中,因为它将在本地工作,但已发布的文件夹不包含您的索引视图。