Downloading exe.config file from clickonce with WebClient class problem - c#

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.

Related

File or directory not found although it exists and the path is correct

I have a problem - I cannot find my file when I open it using http://localhost:49652/.well-known/acme-challenge/FfI7Xeq7_QH5R5pCd3LhAkU4k3nOqBz9mNbvJ9EwMoQ although it exists and the path is correct.
I use ASP.NET C#, OS: Windows Server 2012 And IIS 8.0.
And error:
Help me... Please!
I want to forward you to an other question: What file extensions are blocked by default in IIS
The issue is that IIS has a configuration, how to handle requested files.
Depending on the extension, there have to be done different actions: While resources like .txt or .jpg files are just sent into the network as they are stored on the disk, other files like .aspx or .asmx have to be parsed, executed in dotnet and then the output have to be sent etc.
Other extensions like .dll or .exe are blocked by default, I think.
The problem is, that your files do not have any extension, so for this directory you have to configure that IIS should pass through all of the files.
Found another usefull link to microsoft: https://learn.microsoft.com/en-us/iis/configuration/system.webserver/security/requestfiltering/fileextensions/

app_offline.htm won't help on web.config file

We are using rsync to promote site content (asp.net) to different storages and we use app_offline.htm file before promotion to disable site. Unfortunately this solution doesn't work on web.config file which sometimes cannot be updated and rsync throws rsync: rename failed for "<sitepath>/Web.config" (from .~tmp~/Web.config): Permission denied (13). We had similar issues with .dll files and that's why we use app_offline, but for web.config it doesn't work.
Do you have any idea what might cause it and how to fix it?

Can't Read data From Access Database After Publishing On IIS

I have An ASP.Net web site which reads data from an Access database, It works well, but after publishing it on IIS no data is retrieved.
I'm using the Web config to connect to database
<add name="GisDB" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\AccessDB\Myacdb.mdb;Persist Security Info=False;" providerName="System.Data.OleDb"/>
You may have two specific issues to resolve:
1) IIS cant resolve the path of the Access Database
2) IIS may not be able to instantiate the ACE OLEDB drivers on the server.
A potential solution for 1) is to place the Access database in your /App_Data subfolder off the root of your website. You can specify a connectionstring in the web.config like this
Resolving 2) is trickier, especially if its a remote host. As a start, If using Visual Studio, compile your website binary into x86 mode and see if the problem persists. This could indicate a potential issue with the Access DLLs running on a 64 bit platform.
Almost certainly IIS worker process does not have rights to read files in the d:\AccessDB\ folder. Either grant it rights or move the MDB to an App_Data folder under your website root and change the Web.Config to suit.

Unable to load configuration file web.config - in use by another process

The w3wp.exe process is throwing the following ConfigurationErrorsException:
An error occured loading a configuration file: The process cannot access file file 'web.config' becuase it is being used by another process
Here's what we've determined so far:
The error is intermittant! Sometimes a refresh of the page in the browser is enough to kickstart it again. Sometimes not. The file is locked enough that we cannot open it using notepad when connected directly on the web server.
Because of the intermittent appearance of this error, it does not appear to be a file permission issue.
We have multiple applications under this exact configuration that are having this issue. They are in separate application pools. There have been no changes to the application code around the time that the errors started occuring.
We cannot find any processes other than the w3wp.exe that are accessing this file.
Our web application does not write any changes to the web.config file, only reads values from it.
This error is happening on multiple servers in our web farm
We cannot replicate this error in our development environment. It only occurs in production.
The application are running on x64 servers (Win 2008 Server), using the .NET 4.0 Framework.
Ideas?
In my case the webconfig file was opened in one of the tabs of notepad++ and even the notepad++ was in closed state, once I opened and closed the notepad++ problem disappeared. This suggests checking all instances of file opening is essential.

How to Backup a webservice?

The problem is I reinstalled my computer and the backup didn't work so now all my sourcecode is gone... But my webservice is still running on a webserver.
When I upload the new website the old site will be deleted, so how can i backup the webservice and make it a part of my new website?
In the bin folder of the webserver there is some strange name files like App_web_cjcpmkr8.dll,
can I just download these files and .asmx files? Isnt there then missing a link between the files? How can I see which .asmx files uses which .dll files?
Unfortunately they're all compiled- depending on your site's config, there will be either one assembly per page or per directory. You can download all the DLLs and decompile them through reflector- the decompiled class names should help you match them up with the corresponding markup, but you'll still have some reconstructive surgery to do.
The magic link between the asmx and the dlls lies in the name of the bin folder. IIS will automatically look for dlls in this folder. You should be able to deploy your web service on a new web server by just copying the files. I recommend that you try to set up a copy of the service on a new web server, before you delete anything.
If this is critical data get a service to try and get your files back. If not then moving forward invest in an online backup solution / source control utility.
This will save you tons of time when this happens again. I use source control on a remote server combined with a subscription to Carbonite locally to ensure that I don't lose that precious data; both the data checked in and the data that I'm currently working on. It's Iike $45 a year and well worth it.
As for your data I'm sorry that you've lost it. I'm sure you’re not the first to have this happen.

Categories

Resources