return 404 when browse website create in app service
Hi all
I have a website serviced by app service.
web server is Tomcat 10 on Windows.
I mount a Azure fileshare in path mapping and use it to make a virtual directory.
connect to /force, return 404
browse /test is fine.
Is there anything wrong when I mount this fileshare or set the virtual directory?
Azure App Service
-
ajkuma 24,971 Reputation points • Microsoft Employee
2023-10-29T16:33:45.16+00:00 @orea 邢 , Apologies for the delayed response on this.
As I understand you are referring to the steps outlined in this doc’ for your Tomcat App on Windows App Service WebApp.
Mount Azure Storage as a local share in App ServiceJust to clarify, is it on a VNET or /private endpoints?
Since virtual directories in Azure Web App for Windows are restricted to paths within the c:\home\site (or d:\home\site) physical path, there are additional steps to be able to reference BYOS files via the virtual directory path:
As outlined in the sample by one of colleague:
As an example: For ASP.NET Core / ASP.NET 6 or later and referencing BYOS static files that would normally be in the wwwroot folder of the application, you must override the default folder for static files.
Eg: If you have /mounts/SubFolder as the BYOS mount path, and the wwwroot static files folder directly under the Storage file share, you may use the following in the Program.cs or Startup.cs to serve the static contents from the BYOS-mounted wwwroot folder instead of the local wwwroot folder:
Reference: https://github.com/gabesmsft/AspNetStaticFilesDemo/blob/master/AspNetStaticFilesDemo/Program.cs#L17• app.UseStaticFiles(new StaticFileOptions() • { • FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "/../../../mounts/SubFolder/wwwroot")), • RequestPath = new PathString("") • });
-
ajkuma 24,971 Reputation points • Microsoft Employee
2023-10-29T16:34:18.07+00:00 Adding more:
Also, you may verify that the mount path is reachable within the Web App.
- From the Kudu console https://<yourWebAppName>.scm.azurewebsites.net/DebugConsole , run cd c:\mounts .
- Cd into the mount path subdirectory. For example, if the mount path is /mounts/test1 , run cd test1 .
- For another example, if the mount path is /mounts/test1/folder1, run cd test1/folder1 .
If the mount path subfolder(s) are present but there are no contents or unexpected contents listed, you may check the File share in the Storage account to verify if the expected contents are present.
Kindly let us know, I'll follow-up with you further. -
ajkuma 24,971 Reputation points • Microsoft Employee
2023-10-30T13:27:52.7266667+00:00 @orea 邢 ,
Just checking in to see if you had got a chance to see the previous response. If the answer helped (pointed, you in the right direction) > please click Accept Answer Or please share the requested/more info to help you better.
-
orea 邢 0 Reputation points
2023-10-31T08:06:24.8433333+00:00 thanks for your response.
I use az command in the sample
It responds error message
"Content: {"Code":"BadRequest","Message":"The parameter 'AzureStoragePropertyDictionary' has an invalid value. Details: Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts.","Target":null,"Details":[{"Message":"The parameter 'AzureStoragePropertyDictionary' has an invalid value. Details: Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"01033","MessageTemplate":"The parameter '{0}' has an invalid value. Details: {1}.","Parameters":["AzureStoragePropertyDictionary","Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts"],"Code":"BadRequest","Message":"The parameter 'AzureStoragePropertyDictionary' has an invalid value. Details: Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts."}}],"Innererror":null}"
-
orea 邢 0 Reputation points
2023-10-31T08:17:42.68+00:00 The last response is gone. so I post a new one.
"Tomcat App on Windows App Service WebApp" ->Yes.
"is it on a VNET or /private endpoints" ->No. Is it necessary?
I use the az command in this article.
But it returns the error message in --debug parameter :
{"Code":"BadRequest","Message":"The parameter 'AzureStoragePropertyDictionary' has an invalid value. Details: Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts.","Target":null,"Details":[{"Message":"The parameter 'AzureStoragePropertyDictionary' has an invalid value. Details: Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts."},{"Code":"BadRequest"},{"ErrorEntity":{"ExtendedCode":"01033","MessageTemplate":"The parameter '{0}' has an invalid value. Details: {1}.","Parameters":["AzureStoragePropertyDictionary","Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts"],"Code":"BadRequest","Message":"The parameter 'AzureStoragePropertyDictionary' has an invalid value. Details: Invalid MountPath for Windows Web App. Id: force, MountPath: /home/site/wwwroot/webapp/force. MountPath must be sub-directory of \mounts."}}],"Innererror":null}
-
ajkuma 24,971 Reputation points • Microsoft Employee
2023-10-31T19:36:23.4833333+00:00 Thanks for the follow-up and additional info. I'm checking on this and will get back to you shortly.
-
ajkuma 24,971 Reputation points • Microsoft Employee
2023-11-02T19:01:33.9933333+00:00 Following-up on this, we wish to engage with you offline for a much closer look, please send an email with subject line “Attn:Ajay” to AzCommunity[at]Microsoft[dot]com with the following details, I will follow-up with you.
: Referencing this thread and your Azure subscription ID.Thanks for your patience!
Sign in to comment