microsoft / iis-docker

Dockerfile for IIS
https://hub.docker.com/r/microsoft/iis/
MIT License
288 stars 128 forks source link

Web Applications Supported? #155

Closed jlphillips75 closed 5 months ago

jlphillips75 commented 5 years ago

It seems that web applications are not supported. I've tried a number of methods creating a new web applications in my Dockerfile to no avail. No matter where the physical path, no matter which application pool is used, trying to hit the application yields a 404. To get a better handle on the specifics of this I tried calling from PS within the container to find the 404 followed by this exception:

[HttpException] at System.Web.CachedPathData.GetPhysicalPath(VirtualPath virtualPath) at System.Web.CachedPathData.GetConfigPathData(String configPath) at System.Web.CachedPathData.GetConfigPathData(String configPath) at System.Web.HttpContext.GetFilePathData() at System.Web.Configuration.RuntimeConfig.GetConfig(HttpContext context) at System.Web.Configuration.CustomErrorsSection.GetSettings(HttpContext context, Boolean canThrow) at System.Web.HttpResponse.ReportRuntimeError(Exception e, Boolean canThrow, Boolean localExecute) at System.Web.HttpContext.ReportRuntimeErrorIfExists(RequestNotificationStatus& status)

I believe that this is caused because the Web.config of the web app cannot be found/loaded from any directory other than the site root. For example, if using the "Default Web Site" located at "/inetpub/wwwroot" and trying to hit the web application "test" located in "/inetpub/wwwroot/test", the aforementioned exception is thrown when trying to load the web.config. Is this by design for this particular image? I can't find anything in the dockerfile of the aspnet or iis images that would cause this.

I originally had a number of windows features installed, PS commands to create the site, web app, bindings, etc. and none of it worked. This image really seems to lock a number of configurables down. Right now, it's simplified with the following:

( Build layer omitted for brevity ) ... FROM microsoft/aspnet AS release RUN MKDIR /inetpub/wwwroot/test COPY --from=build /app/testapp/bin/Release/Publish /inetpub/wwwroot/test RUN New-WebApplication -Name 'test' -Site 'Default Web Site' -PhysicalPath '/inetpub/wwwroot/test'

Any clarification or ideas would be much appreciated.

Thanks!

Kaderbhai commented 3 years ago

Was there a resolution for this issue, I've got the same issue. SImilar route attempted to start the app using ServiceMonitor.exe w3svc and editing the IIS default pool and site more directly using the powershell cmdlets. From what I can tell IIS is running correctly but not running the webconfig for some reason or another.

I've also attempted this: New-WebApplication -Name 'test' -Site 'Default Web Site' -PhysicalPath '/inetpub/wwwroot/test' (used the equivalent file path for mine) but that didn't stop the 404 error

Any ideas? Thanks