Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Problem with static files. ASP.NET 5 + Docker

$
0
0

Hi. I've problem with static files in my asp net 5 app. Starting my app on Windows  through Visual Studio using DNX everything looks perfect. But on Debian running Docker my app can't access any files that are not directly in webroot folder. For example Index.html loads ok but stylesheets and js from subfolders cannot be reached (404 error). Can you help me out? I'm stuck on this for a while.

Here is my Configure method:

public void Configure(IApplicationBuilder app)
    {
        app.UseDefaultFiles();
        app.UseStaticFiles();
    }

Project.json file:

{"version":"1.0.0-*","compilationOptions":{"emitEntryPoint":true},"dependencies":{"Microsoft.AspNet.Server.Kestrel":"1.0.0-rc1-final","Microsoft.AspNet.StaticFiles":"1.0.0-rc1-final"},"commands":{"web":"Microsoft.AspNet.Server.Kestrel    --server.urls=http://0.0.0.0:5000"},"frameworks":{"dnxcore50":{}},"exclude":["wwwroot","node_modules"],"publishExclude":["**.user","**.vspscc"]}

and dockerfile

FROM microsoft/aspnet:1.0.0-rc1-update1-coreclr

COPY ./app
WORKDIR /app/approot/src/WebApplication5
RUN ["dnu","restore"]

EXPOSE 5000
ENTRYPOINT ["dnx","web"]

Here is ls -l output from my wwwroot directory on VPS

drwxr-xr-x 7 root root  4096Jan2618:07Components
drwxr-xr-x 2 root root  4096Jan2618:07Images
drwxr-xr-x 2 root root  4096Jan2618:07Scripts
drwxr-xr-x 2 root root  4096Jan2618:07Styles-rwxr-xr-x 1 root root  9582Jan1020:31 cart.html-rwxr-xr-x 1 root root 13569Jan1020:29 category.html-rwxr-xr-x 1 root root 10467Jan1020:30 index.html-rwxr-xr-x 1 root root  6282Jan1517:50 login.html-rwxr-xr-x 1 root root 13273Jan317:39 rowsgrid.html-rwxr-xr-x 1 root root  4611Jan1020:31 signin.html-rwxr-xr-x 1 root root   396Jan2618:07 web.config

And for eg. from /Styles:

-rwxr-xr-x 1 root root 14976Jan1020:28Site.css

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>