Cannot download ".config" files from host via http - c#

I've published my ClickOnce application to my website via FTP.
I've got 404 error (not found) when run "app.application". In log file there is a line that says cannot find "app.exe.config" file.
I noticed that I can access to this file via FTP and online file manager of website, but when I try to use HTTP, this error is shown.
I've created new files with different names on website (all of them have .config or .cfg extension), but result is the same: I cannot access them via HTTP (through address bar of browser).
I am using a windows web hosting server and it has a "web.config" file in the root folder of website.
Should I do any change in server settings or I must rename my .config file?
any help will be appreciated.

Related

Setting html site

so I have an asp.NET website I've developed. I bought a domain and a host service. I went to the host services and uploaded all the files.
Problem: the start page has to be index.html/htm (which is located in root directory/httpdocs) but visual studio doesn't create a index.html file, so i made one myself. Thing is I cant redirect to any other files, I don't know the path. I've tried:
- "mywebsite.com/otherfile.aspx" but it says file not found.
- "mywebsite.com/httpdocs/otherfile.aspx" file not found.
- "/otherfile.aspx" file not found.
- "~/otherfile.aspx" file not found.
can anyone think of how I could access this file? I've never setup a website :(
are you sure that your hosting provider supports .Net? Httpdocs and Plesk sound like a Linux server that is not configured to server .aspx files.

Copy a file from one server folder to another folder using webservice

I am using a webservice to accept a URL of an already uploaded file
and want to copy this file (which is in one server with public access) to another server folder
issue is that when Server.Mappath is used, it is always referring to the web Service project location and not to the URL's location.
Is there anyway that I can copy the file using webservice with the URL only?
if the file is located in a different web site than the webservice, then you have to tell your webservice where are the files located. You could put a key in web.config for this location and then compose the filename:
Path.Combine(ConfigurationManager.AppSettings["FilesPath"],fileName);
Be aware that you have to have access rights to that folder.

How can I force a file download on IIS 6.0 server

I am using IIS 6.0. I have a file with no extension that is saved on my server, If I try to download this file it gives me a 404 page, how can I force the server to send the file as downloadable if the file exists
In order to get IIS to download the file it needs to have a file extension because IIS will only server file types that have been registered in the MIME Types collection. And in order for a file type to be registered under a MIME type it will need an extension.
You could build a simple ASP.NET HttpHandler that issues the file. That will work.

Cannot download .sql, .flag, .tmp, .InstallState files with WebClient

I'm trying to download some files from a virtual directory using WebClient class and DownloadFile method, all files download good except files with .sql, .flag, .tmp, . InstallState extensions. I get the "HTTP Error 404 - File or directory not found" error. This extensions are not in the Application Configuration Mappings, so what do I have to configure in order to download this files? Because I can't figure it out. Thx. (I'm using windows server 2003 )
The reason for this is that the web server probably doesn't have MIME types configured for these file extensions.
Because these are being served as static files over HTTP you'll need to add them.
If these files are residing on a public facing server administered by you, do you think it's wise to be serving these? Why not obtain via FTP?

Downloading exe.config file from clickonce with WebClient class problem

I'm downloading from clickonce server new versions of files by my autoupdater. However, any time downloading cycle comes over MyApplication.exe.config file on the server webClient.DownloadFile(remoteFile, localFile) throws a System.Net.WebException with code 500 (internal server error or something like that). At the same time application event log renders few entries from asp.net, like
failed to initialize AppDomain /LM/W3SVC/1/ROOT
Exception: System.Configuration.ConfigurationErrorsException
asp.net process id doesn't have permission to access GAC
aspnet_wp.exe stoped.
But the cycle continues successfully for all other files.
Does it somehow figures that it is config file for a web server, since asp.net is .NET framework itself and "knows" about .config file?
As was already mentioned in the other answer, IIS will not serve .config files. Where my answer is different is the proposed work around: ClickOnce has an option to use .deploy files, where all your file names have a .deploy extension appended to them. This neatly gets around the IIS config transfer problem.
IIS, by default, does not serve up .config files. Do you have access to the IIS configuration on the ClickOnce server, so that you can see if .config is disallowed in the request filtering module?
In IIS 7, it's in Request Filtering in the IIS section. I'll see if I can find where that's configured in IIS 6.

Categories

Resources