【发布时间】:2020-02-15 06:41:44
【问题描述】:
如何在asp.net core中部署cshtml文件? 如果我发布我的 asp.net 核心项目,则不会发布 cshtml。 如何在Chrome中直接运行cshtml文件?
这里有一些代码可以进一步解释这一点
我的 Program.cs 文件包含
public static void Main(string[] args)
{
//since zoho can pass only 10 parameters in one webhook we are splitting into two updates
//update1
UpdateClassBoatFromZohoModel upd = new UpdateClassBoatFromZohoModel();
upd.OnGet();
//update2
UpdateClassBoatFromZohoModel2 upd2 = new UpdateClassBoatFromZohoModel2();
upd2.OnGet();
//CreateWebHostBuilder(args).Build().Run();
}
现在UpdateClassBoatFromZoho.cshtml 和UpdateClassBoatFromZoho2.cshtml 这些文件中的每一个都将使用不同的查询字符串参数在浏览器中提供。该怎么做?
【问题讨论】:
-
您好,您能提供一些额外的信息或代码示例吗?
-
当我发布它时,它只是将所有内容转换为 dll。我想在浏览器中单独运行 cshtml 文件。该怎么做?
-
我想您可以说 .cshtml 文件类似于 .cs 类文件:因为文件本身不是发布的“静态文件”,而是通过编译到程序集中使用的。您需要将 .cshtml 文件公开为视图或剃须刀页面等,而不是将其视为静态文件或资源。
-
@Michael 怎么做?
-
我想在 google chrome 中打开 cshtml 文件,并在 cshtml 文件使用 queryhelpers 解析的查询字符串中传递参数。例如。 abc.cshtml?x=1&y=2&z=3 等...
标签: asp.net-core