Asp.net 发布的文件看起来与localhost不同
所以我通过VS project->publish web site->ftp发布了一个网站。当我打开它时,我发现所有的东西都不合适,好像这个网站根本没有css。我开始查看网站在线版和本地版的HTML,在顶部我注意到: 在线:Asp.net 发布的文件看起来与localhost不同,asp.net,.net,iis,publish,http-status-code-403,Asp.net,.net,Iis,Publish,Http Status Code 403,所以我通过VS project->publish web site->ftp发布了一个网站。当我打开它时,我发现所有的东西都不合适,好像这个网站根本没有css。我开始查看网站在线版和本地版的HTML,在顶部我注意到: 在线: <title> ... </title><script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script> <
<title>
...
</title><script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>
<link href="/Content/css?v=0mo0uNbGUFWt4hgQ0AZZm5kcuaVkDkYEBh4UeS1mWi41" rel="stylesheet"/>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
<title>
...
</title><script src="/Scripts/modernizr-2.6.2.js"></script>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/Site.css" rel="stylesheet"/>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
...
localhost:
<title>
...
</title><script src="/bundles/modernizr?v=wBEWDufH_8Md-Pbioxomt90vm6tJN2Pyy9u9zHtWsPo1"></script>
<link href="/Content/css?v=0mo0uNbGUFWt4hgQ0AZZm5kcuaVkDkYEBh4UeS1mWi41" rel="stylesheet"/>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
<title>
...
</title><script src="/Scripts/modernizr-2.6.2.js"></script>
<link href="/Content/bootstrap.css" rel="stylesheet"/>
<link href="/Content/Site.css" rel="stylesheet"/>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
...
这些文件应该是相同的,但看起来像.NET将具有相同扩展名的文件合并到一个文件中。到目前为止,好吧,我想这就是
的目的。
但是文件/Content/css?v=0mo0uNbGUFWt4hgQ0AZZm5kcuaVkDkYEBh4UeS1mWi41
甚至没有打开,它返回一个403.14-禁止的错误
错误的原因是什么?如何修复此问题?您的所有CSS文件都已绑定到一个文件中。如果web.config文件中的system.web编译标记中有debug=“true”,则不会执行此操作
关闭它,重新编译,然后您将在本地看到该文件。您的所有CSS文件都已绑定到一个文件中。如果web.config文件中的system.web编译标记中有debug=“true”,则不会执行此操作
关闭它,重新编译,然后您应该可以在本地看到该文件。默认情况下,在名为Bundle.config的webforms应用程序中创建了一个文件。它包含缺少的css包的定义。您是否已将其删除,或是否已从发布的文件中丢失?这可能会导致你所看到的。我删除了我的,所有的css立刻消失了,因为现在它没有匹配到一个捆绑的URL
它名为Bundle.config,位于根文件夹中,包含以下内容:
<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
<styleBundle path="~/Content/css">
<include path="~/Content/bootstrap.css" />
<include path="~/Content/Site.css" />
</styleBundle>
</bundles>
在webforms应用程序中,默认情况下会创建一个名为Bundle.config的文件。它包含缺少的css包的定义。您是否已将其删除,或是否已从发布的文件中丢失?这可能会导致你所看到的。我删除了我的,所有的css立刻消失了,因为现在它没有匹配到一个捆绑的URL
它名为Bundle.config,位于根文件夹中,包含以下内容:
<?xml version="1.0" encoding="utf-8" ?>
<bundles version="1.0">
<styleBundle path="~/Content/css">
<include path="~/Content/bootstrap.css" />
<include path="~/Content/Site.css" />
</styleBundle>
</bundles>
如何仅禁用文件合并?我不想在发布时将debug设置为true…从Bundle.config中删除所有文件夹。如何仅禁用文件合并?我不想在发布时将debug设置为true…从Bundle.config中删除所有文件夹。该文件位于根文件夹中,其内容与此一模一样该文件位于根文件夹中,其内容与此一模一样