I am facing an issue related to file access over HTTP in Wildfly(JBoss).
I am running an application on Wildlfy-9.0.1.Final
In my application there is a link on click, it supposed to open respective file and display its content. But when I click on link it gives me 404-Not found error.
I could see that file exist on same path as given in href in anchor tag. I don't understand what it makes to give 404 Error.
Is there any other settings that I need to enabled in Wildfly to access files over HTTP. If so, please advice.
EDIT:
My path in <handlers> looks like this
path="/usr/local/jboss/server/default/deploy/"
This directory structure is not yet complete as there will be more path appended dynamically at run-time using java code where actual file will reside.
For ex: path="/usr/local/jboss/server/default/deploy/demo/1/filename"
of which /usr/local/jboss/server/default/deploy/ is static path and demo/1/filename is dynamic.
Also in /directory-listing-uri in location some path is dynamic generated at tun time.
For ex:
Assume below is directory-listing-uri
http://[wildfly host]:[port]/{static}/{dynamic}/{dynamic}/{dynamicFileName}.iif
So I am not sure how wildfly will serve my purpose of displaying files.
Please correct if I am incorrect.
To expose a directory for file listing (and download), you could add two configuration elements in your standalone.xml configuration (if you run wildfly as standalone server) like this:
<subsystem xmlns="urn:jboss:domain:undertow:2.0">
...
<server name="default-server">
...
<host name="default-host" alias="localhost">
...
<location name="/directory-listing-uri" handler="directory-listing-handler"/>
...
</host>
...
</server>
...
<handlers>
...
<file name="directory-listing-handler" path="/home/example/..." directory-listing="true"/>
</handlers>
...
</subsystem>
Note: For jboss-cli configuration, you can take a look at this answer
You will then get a nice Directory Listing GUI at this location:
http://[wildfly host]:[port]/directory-listing-uri
Related
I am running IIS under Windows Server 2016 and I'm trying to run an ASP.Net core 3.1 application but I can't get past this error:
500.19 error
(The language in the picture is Hungarian, but it contains no useful information whatsoever, just an example)
Here is my web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Minibizz.Routing.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="inprocess" />
</system.webServer>
</location>
</configuration>
What am I missing?
P.S.: The web.config was created by Visual Studio 2019.
The reason behind the issue:
That error message goes on to say what exactly is bad about your configuration file, hence you should refer the “Config Error” and “Config Source” sections. This problem occurs because of the ApplicationHost.config file or the Web.config file contains a malformed or unsupported XML element.
if you are using url rewrite rule then install url rewrite Extention of iis. Enable ANCM logging, ie. set stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout\" (I think the path needs to end by a backslash), then run the web app and see if something gets logged into the stdout folder. Verify that the log directory exists at the path referenced by the web config. If it does not, create it. The path shown in your config would place the "logs" directory in the root folder of the deployed site. Verify that the application pool has to write access to the logs directory.
Make sure you installed the .net bundle.check that you installed below iis feature:
You may also need to verify that the path to the dotnet executable exists in the deployment machine's environment variables. To check this, first find the path where dotnet.exe is installed. It is generally located in either C:\Program Files\dotnet or C:\Program Files (x86)\dotnet. Once you know the path, ensure that the path exists in your Environment Variables.
The web.config content seems to be correct. If you use a clean web.config copy, does the problem persist? If the issue can be solved by replacing web.config with clean configuration content, then the problem is exactly with this web.config. In this case, I suggest you remove parts of the web.config content to narrow down the issue. If the pages show correctly after you remove one section, then the problem is with that section. You need double-check what's wrong with the section and update the correct configuration.
If the problem remains even with clean web.config content, I suggest you access other pages in different folders in your site to see if the problem still exists.
you could refer this below link for how to publish asp.net core site in iis:
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-3.1&tabs=visual-studio
I want to open file video but it not working
I'm tried enabled directory browsing.
Tried run aspnet_regiis.exe -i
Finally
How to open it? How to make it working? Thank you!
Hi i know is a old post but i hope that it can help you
1.- First create a folder into C:\inetpub\wwwroot example : resources
2.- Open IIS or windows + R and write inetmgr
3.- You'll see the folder you just created
4.- select the folder for this example "resources" and you'll see on the right all option to config
select and open "directory browsing" there's an option to change disabled/enable put it on enable and save changes
5.- Open browser and type the ip or url of your site and you'll see the files
6.- if you can't open the file check if the MIME Types and add the format of the resource.
This changes will be on Resources Folder or in the folder that you're working.
According to your description, I suggest you could add below config to set the MP4 mime map setting for your IIS web application.
<?xml version="1.0"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".m4a" mimeType="video/mp4" />
</staticContent>
</system.webServer>
</configuration>
More details, you could refer to below article:
https://blogs.iis.net/bills/how-to-add-mime-types-with-iis7-web-config
I just enabled source maps because, sure why not, I'd like to try them out. However, I'm finding that IISExpress will not download .coffee files so it doesn't work.
I'm sure it's a simple web.config modification, I'm just not sure which one. How do I configure it to serve these?
All of IIS Express's configuration is done through the configuration files; in this case you want
C:\Users\[user]\Documents\IISExpress\config\applicationhost.config
In that file, there's a list of all of the static content types that IIS Express knows about and is willing to serve. You just need to add your extension to that list. The list starts about 1/2 down the file, in this XML element:
<staticContent lockAttributes="isDocFooterFileName">
It should be pretty obvious what to do from there: just map.coffee files to the correct mime type.
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
This element is found within the system.webServer element, which is one of the ones that supports delegation to individual web.config files, so you should be able to add a similar XML block to your project's configuration file:
<system.webServer>
<staticContent>
<mimeMap fileExtension=".coffee" mimeType="text/plain" />
</staticContent>
</system.webServer>
I've spent half of a day trying to understand why the following fails.
I can add section anywhere but never got it working like that ():
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<mysection />
<system.web>
<compilation debug="false" batch="false" targetFramework="4.0" />
</system.web>
<system.webServer>
<handlers>
</handlers>
</system.webServer>
</configuration>
I think the error related to .NET 4, because when you put section without pre-configuration in applicationHost.config it shows error with gray border saying that config is incorrect. That is what I expect. Then I add section definition and everything seems to work I can edit config from console - this means it is parsed correctly now.
But when I try to reach Application, it gives:
Parser Error Message: Unrecognized configuration section mysection
with a piece of config on yellow background.
Or do I need to write a module to consume that settings ? At the moment I do not have any, just a text in config.
following links will help you understand for this.
http://www.codeproject.com/Articles/32628/ASP-NET-Custom-Web-Configuration-Section
https://web.archive.org/web/20211020133931/https://www.4guysfromrolla.com/articles/032807-1.aspx
Regards,
Old topic but these links are very helpfull:
http://www.iis.net/learn/develop/extending-iis-configuration/configuration-extensibility
http://www.iis.net/learn/develop/extending-iis-configuration/extending-iis-schema-and-accessing-the-custom-sections-using-mwa
Edit (05/25/2016) :
The Details of how to store custom information in applicationHost.config file ... I hope this helps !
Note : These settings wont be visible on IIS Manager. There is a way to do that but thats beyond the scope of this response.
Requirement:
Need to extend the system.applicationHost/sites section of applicationHost.config file to allow a siteowner attribute at the site level. (IIS Does not allow us to do this by default). Nor can you manually edit the applicationHost.config file and add custom tags/attributes.
Steps:
Create a custom schema ( xml ) file under %windir%\system32\inetsrv\config\schema\ . File name: siteExtension_schema.xml
Include the custom elements that you want to eventually save in the applicationHost.config in that xml and save it with a appropriate name. The crucial thing to keep in mind is the sectionSchema tag.So when extending the schema of an existing section, simply create a element and set the name attribute to be the same as an existing section. In the schema file (see below), we have defined a with a name of "system.applicationHost/sites" - this is the same as the sectionSchema name in the default IIS_Schema.xml file in the Schema directory. So in essence you are instructing IIS to add these
<!-- Contents of %windir%\system32\inetsrv\config\schema\siteExtension_schema.xml -->
<configSchema>
<sectionSchema name="system.applicationHost/sites">
<collection addElement="site">
<attribute name="owner" type="string" />
<attribute name="ownerEmail" type="string" />
</collection>
</sectionSchema>
</configSchema>
Test the modifications by adding values for the "owner" and "ownerEmail" attributes that we included in step 2 above and then check the configuration file (applicationHost.config) to see the changes. Simply run the following command (must be elevated as Administrator) from the command line (uses appcmd ) to do so:
C:\> %windir%\system32\inetsrv\appcmd set site "Default Web Site" /owner:"John Contoso" /ownerEmail:"john#contoso.com"
To see if the configuration was applied, run the following command and check the output:
C:\> %windir%\system32\inetsrv\appcmd list site "Default Web Site" /config
<system.applicationHost>
<sites>
...
<site name="Default Web Site" id="1" siteOwner="John Contoso" siteOwnerEmail="john#contoso.com">
...
...
</site>
</sites>
</system.applicationHost>
To Read and Write your settings programmatically thru C# :
//this Will work with the ServerManager.OpenRemote("MyRemoteHostname") method also
using(var mgr = new ServerManager())
{
//Read
Console.WriteLine(mgr.Sites["Default Web Site"].Attributes["owner"].Value ); //Prints "John Contoso"
//Write
mgr.Sites["Default Web Site"].Attributes["owner"].Value = "New Owner";// Sets new value
mgr.CommitChanges(); // commits the changes to applicationHost.Config
}
If i have a page on my website called blah.aspx then there will be another file there called
blah.aspx.vb
I can browse to blah.aspx but if I try to browse to blah.aspx.vb, I'll get 'file not found' page.
If I change the name of blah.aspx.vb to blah.zip it can be downloaded via the browser.
If I change the name to blah.qaz I'll get the 'file not found' again.
I suspect that the server will not allow the .aspx.vb file to be downloaded but if it doesn't protect a .zip file why does it protect a made up .qaz or is that just a shortcoming of the browser?
Are there file extensions that a server will actively protect?
Are there file extensions it deliberately won't hide (e.g zip)?
What are the rules and where can you find them?
IIS 7 maps 'allowed' extensions (or extensions that it will handle) in the applicationhost.config file.
If you really want to allow a 'qaz' extension, you could add a mimeMap to add it as static content. Don't know what webserver you're using, but if you're on II7+, you should be able to add it to your web.config:
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".qaz" mimeType="text/plain" />
</staticContent>
</system.webServer>
</configuration>
If you're on an earlier version of IIS, then it's a different ballgame. If you're on some other webserver, you'll have to search around for the configuration information, but most will have some configuration file that states which extensions they are ok serving.