Reputation: 131
I've sample asp.net 5 app running in docker container on my VPS (Debian 8) using dnxcore50. App consist only with static files (html, css, js). Both on my local VM running docker and on VPS any files that are not in wwwroot directory eg. /styles/, /components/, /scripts/ cannot be accessed. Requests for this files have status 200, but server doesn't send any data back.
Here is my Configure method:
public void Configure(IApplicationBuilder app)
{
app.UseIISPlatformHandler();
app.UseStaticFiles();
app.Run(async (context) =>
{
});
}
Project.json file:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"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 4096 Jan 26 18:07 Components
drwxr-xr-x 2 root root 4096 Jan 26 18:07 Images
drwxr-xr-x 2 root root 4096 Jan 26 18:07 Scripts
drwxr-xr-x 2 root root 4096 Jan 26 18:07 Styles
-rwxr-xr-x 1 root root 9582 Jan 10 20:31 cart.html
-rwxr-xr-x 1 root root 13569 Jan 10 20:29 category.html
-rwxr-xr-x 1 root root 10467 Jan 10 20:30 index.html
-rwxr-xr-x 1 root root 6282 Jan 15 17:50 login.html
-rwxr-xr-x 1 root root 13273 Jan 3 17:39 rowsgrid.html
-rwxr-xr-x 1 root root 4611 Jan 10 20:31 signin.html
-rwxr-xr-x 1 root root 396 Jan 26 18:07 web.config
And for eg. from /Styles:
-rwxr-xr-x 1 root root 14976 Jan 10 20:28 Site.css
Upvotes: 1
Views: 2819