Asp.net Core 1.0 VS2015 IISExpress 改变了 App URL: 结果.css 404
Asp.net Core 1.0 VS2015 IISExpress changed App URL: results in .css 404
.css(和其他)更改 Web 服务器设置应用后出现 404 错误 URL:VS2015 中的端口号。
我从项目模板创建了一个空白 Asp.net Core 1.0 MVC 6 网页项目,添加了一个控制器,添加了一些绑定,这样我就可以在 nat 上从我的移动浏览器中点击它,按 F5一切都很好。
我决定我想要一个完整的网页,经过一些研究,我认为删除第一个网站并重新创建一个完整的(不是空白的)网站会更容易。我想在我的解决方案中保留相同的项目名称。这个应用程序可以很好地显示默认模板中的图像和 carousal。我添加了我的控制器,它也能正常工作。
我更改了 Web 服务器设置应用程序 URL:端口号,因为我的移动应用程序使用的是原始开发端口。 css 和图像文件夹中的内容不太好 404 错误。
我尝试清理浏览器缓存。重建网络项目。重启VS。杀掉 Microsoft.VsHub.Server.HttpHostx64.[exe|com].
此 SO post 建议对 acl 进行一些更改。我试过这些。
netsh http delete urlacl url=http://localhost:60262/
netsh http add urlacl url=http://*:60262/ user=everyone
这是我的applicationhost.config(所需端口是 60262 是 61044)
<site name="MissD.Web" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\jeffa\Source\Workspaces\Miss Direction\MissDirection\MissD.Web\wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:60262:192.168.1.176" />
<binding protocol="http" bindingInformation="*:60262:localhost" />
</bindings>
</site>
我的假设又是驴子了。我根本不知道它为什么起作用,我对此很好奇,VS 在项目创建时创建的默认端口在 startup.cs
中如下所示
// app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(@"C:\Images"),
RequestPath = new PathString("/StaticImageFiles")
});
我改成了
app.UseStaticFiles();
app.UseFileServer(new FileServerOptions()
{
FileProvider = new PhysicalFileProvider(@"C:\Images"),
RequestPath = new PathString("/StaticImageFiles"),
// EnableDirectoryBrowsing = true
});
现在工作。尝试更改应用 URL: 几次。没问题。
.css(和其他)更改 Web 服务器设置应用后出现 404 错误 URL:VS2015 中的端口号。
我从项目模板创建了一个空白 Asp.net Core 1.0 MVC 6 网页项目,添加了一个控制器,添加了一些绑定,这样我就可以在 nat 上从我的移动浏览器中点击它,按 F5一切都很好。
我决定我想要一个完整的网页,经过一些研究,我认为删除第一个网站并重新创建一个完整的(不是空白的)网站会更容易。我想在我的解决方案中保留相同的项目名称。这个应用程序可以很好地显示默认模板中的图像和 carousal。我添加了我的控制器,它也能正常工作。
我更改了 Web 服务器设置应用程序 URL:端口号,因为我的移动应用程序使用的是原始开发端口。 css 和图像文件夹中的内容不太好 404 错误。
我尝试清理浏览器缓存。重建网络项目。重启VS。杀掉 Microsoft.VsHub.Server.HttpHostx64.[exe|com].
此 SO post 建议对 acl 进行一些更改。我试过这些。
netsh http delete urlacl url=http://localhost:60262/
netsh http add urlacl url=http://*:60262/ user=everyone
这是我的applicationhost.config(所需端口是 60262 是 61044)
<site name="MissD.Web" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\jeffa\Source\Workspaces\Miss Direction\MissDirection\MissD.Web\wwwroot" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:60262:192.168.1.176" />
<binding protocol="http" bindingInformation="*:60262:localhost" />
</bindings>
</site>
我的假设又是驴子了。我根本不知道它为什么起作用,我对此很好奇,VS 在项目创建时创建的默认端口在 startup.cs
中如下所示// app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions()
{
FileProvider = new PhysicalFileProvider(@"C:\Images"),
RequestPath = new PathString("/StaticImageFiles")
});
我改成了
app.UseStaticFiles();
app.UseFileServer(new FileServerOptions()
{
FileProvider = new PhysicalFileProvider(@"C:\Images"),
RequestPath = new PathString("/StaticImageFiles"),
// EnableDirectoryBrowsing = true
});
现在工作。尝试更改应用 URL: 几次。没问题。