I have a ASP.NET Webforms compiled site that works flawlessly on my local machine. As soon as the site is pushed up to the live servers (A bank of 10 servers running IIS8 on windows server 2012) the site will recompile on every request.
If I go to the temporary ASP.NET files directory there are App_Web dlls for all the user controls in the site along with .delete files for all the binaries which is what I think is causing the appdomain to restart every time.
App_Web_course.aspx.cdcab7d2.ijbbuqi7.dll
App_Web_course.aspx.cdcab7d2.ijbbuqi7.dll.delete
It does occasionally run OK on some of servers and when I look at the temp .NET files on those servers the .delete files aren't there.
I'm pulling my hair out, In 17 years of development, I've never seen this before and there seems to be no rhyme or reason for it.
Update: If anyone else experiences this, please check my answer below for my resolution.
I have an update and solution to the problem.
At the time of the original post, I had left out that the files were located on an SMB network share. This has been the cause of this constant recompiling due to the fcnMode of ASP.NET.
Process Monitor showed thousands of requests through w3wp.exe for "FileChangeNotify" which when hitting a critical directory such as "bin" it would cause a recompilation and application restart.
Luckily there is a single line fix for this. In the web.config(s) of your project, alter the following line to include the following attribute:
<httpRuntime fcnMode="Disabled" />
This will stop ASP.NET from scanning your network directory for constant file changes.
Possible reasons that cause recompile.
You update the web.config
You create/delete the app_offline.htm file on the root.
You create/modify any .aspx or .aspx.cs file
You create/modify files on App_Code folder
You have left some upload folder unattended and users upload aspx files.
You time/date on the computer is wrong (back some years)
You can use the Process Monitor to see what happening from all that if you can not locate it on code or don't know what other libraries do.
Related
I have a VPS (Cloud Server) and I have Visual Studio, IIS, SQL... all those nice things installed. I am also sometimes doing development on this VPS.
This website is basically a simple file manager. When it loads, it lists files and folders that resides in the App_Data folder. This said, I am using the App_Data as my "root/home/topmost-directory" for the file manager.
The reason I am putting them in the App_Data folder is because I don't want users to just go like this: www.mywebsite.com/ROOT/[gets a list of files].
Instead, if they try to go: www.mywebsite.com/App_Data/[tries to get list], IIS will block them with a nice error (because IIS blocks access to that folder).
So, the website accesses the structure in the App_Data folder via code behind. This is how the website navigates. It can download, upload, move files around, rename... delete... everything right to/inside the App_Data folder.
The only problem is, this only works when I run the website in Visual Studio and run my tests, testing the website, debugging, etc. The moment I publish (via File System in Visual Studio) the website to the directory: "C:/inetpub/Sites/[WebsiteFolder]", and navigates to the website's URL, the website does not work any more. It loads, but it does not get the file structure in the App_Data folder any more, it cannot create new folders, cannot rename them...
This website works fine when I upload it via FTP to another webs space that is hosted somewhere else at another hosting company (which is shared hosting).
So I guess (my best guess) the IIS on my VPS does not allow this kind of access. And I have been trying to find settings on IIS somewhere that would/could allow this.
I have enabled directory browsing, but that's probably the only thing I can think of other than making sure the directory is accessible (readable/writable).
Do you perhaps know what else I can try?
Ohkay, so this was a very silly mistake - but that's how we learn!
The App_Data folder did not have any other files or folders inside of it.
And as we know, ASP.NET does not publish empty directories. This means those empty folders never existed once I published the website.
There are 3 ways to fix this that I know of at the moment:
If your solution has a publish profile (so that you can publish the site), you can right click the empty folder in Visual Studio, and say Publish [FolderName] eg:
You can just create an empty file in that directory, and publish your whole website again. Because the folder is not empty any more, it publishes with the rest of the website.
Just manually create the folder on your hosting space.
Thanx for everyone's input!
Greatly appreciated!
I'm new to ASP.NET, and making a small update to a site that already exists. I am confused about the differences I see on the production server vs. the source code I've been given, and would appreciate any explanation or advice. Normally I would just continue reading and researching until I understood fully, but in this case I've been asked to make a small update to something ahead of my understanding. All I need to do is change one element in a form.
On the production site, there are files like \contact\survey.aspx; no .cs files exist in the directory alongside them, and there's no CodeFile directive. Instead, there are a multitude of DLL files corresponding to these pages, like bin\App_Web_survey.aspx.fdf9difs9.dll.
When I was given the source code of the site to edit, I see something different. The bin folder is entirely lacking in these DLL files corresponding to pages; instead, each aspx file has an aspx.cs file sitting next to it in its folder, a code-behind. Fair enough, I think; the site can run in its interpreted mode, like this, or compiled to DLLs.
Problem is, for the life of me I cannot work out how to do that; I've read dozens of pages on the MSDN library and gotten nowhere.
I am using Visual Studio Express 2013 for Web, and I've opened the source code folder as a website. When I run 'build', it succeeds, but no DLLs are made, not even in the Debug folder. This MSDN page has instructions for compiling web application projects, but the options don't correspond to the available options for me, so I'm guessing that either web application and web site are distinguished or that Visual Studio 2013 (which I also tried using and had no luck with) is distinguished from VS for Web. I'm at a loss.
tldr: Can anyone quickly sum up for me the process of compiling an ASP.NET website in a way that results in multiple DLL files in its bin directory?
You might need to use aspnet_compiler:
aspnet_compiler -p sourceCodeRoot -v / targetRoot
See How to: Precompile ASP.NET Web Sites for Deployment (MSDN).
I have a new application i would like to deploy to a Managed Server I have recently signed up for. I would like to know what would be the best way to deploy to it. In my experience I have seen that many of the asp.net applications just push dlls to the server. How is this achieved?.
I have Tortoise SVN as my subversioning system. I have a repository on another server and usually i commit my changes and then update my release folder in the managed server but this has all the .aspx, solution and other files I belive are not needed. How can I do my set up so that I only push the dlls and when updating that only dlls are updated?.
I am not too clear on this and would like an explanation and best practices given this scenario.
I have faced similar questions before and follow the below steps every time I move the compiled files for incremental fixes in my application.
Maintain two separate copies of the solution files - Local Application and Production application
//This is very important because once you go to production environment. One copy for your local working and other copy only for deploying in the live server. This copy should be up to date with your live server copy.
Make the changes to files and compile and test the application in your local application folder/solution. Now commit only the files that you edited. SVN will take care of this. It will show you a possible "red mark" for the files which differ from the updates present in the repository. In this way you can track the pages which were modified.
Now open open your production solution folder and update the folder. This will update the files in production application folder.
Now compile and test the changes done. Verify if its issue is fixed or the changes are reflected same as the Local application copy. Now build the application and publish to a folder.
To know the modified files:
DLLs:
Go to the bin location of the folder and "order by" modified date. These are the dlls which are to be copied and replaced with in your life server.
ASPX/ASCX
a) Open SVN of production application folder. Right click and click show log. This will show all the files modified/updated with date. Select the ones last updated and note down the location.
b) Now navigate to the location in your published folder and select those files "ordered by" descending/ascending modified date of the files. Replace those files alone to your LIVE server.
Note: This is certainly not the best possible solution, but one of the general practices followed throughout the industry. There are few other plugins which can track changes and publish the relevant files to your published folder. But again ,this is applicable only if you have the source codes and application files in the same machine as of the one you are hosting the application from. Let me know if you have any question in this.
You can just use visual studio web deploy, it will automagically figure out what needs to be updated and only pushes what is necessary unless you ask it otherwise.
I came across the solution of this genetic problem all across the internet and Stackoverflow, but none of them talk about the same after/on deployment. I also read this famous article . So, my website runs absolutely fine via VS 2010. However, I get this problem the moment I deploy my website using the copy tool of VS 2010.
There are three web.config files in. 1- root, 2- Users folder, 3- accounts folder. The tag exists in the web.config file in the root. The hierarchy of which looks like: domain.com / httpdocs / websitefolder / web.config. In the websitefolder there are Accounts and Users folders which further contain web.configs, but non of them have the tag.
What could possibly go wrong from the development machine to deployment? The error I am getting is on line:
Line 16: <authentication mode="Forms">
In the httpdocs, there are other projects with web.configs, can that be a problem? In that case, I also deleted their contents, but didn't help (but may be I should have done a better job? I don't know if this is what was required at all?).
Also, this is a website, so there's no bin or obj folder being created, none of that kind of issue. Please suggest, I am not able to figure out the problem. Thanks a lot.
Usually when you have multiple sites in sub directories of one site, inspite you delete a web.config, the problem will persist. In that case even the sub folders should be marked as an application.
Is the folder in which you have this website deployed an application in IIS? It is one main reason why this error could occur.
If its not, make it as an application and the problem should resolve.
Update: Seems you have used File System while developing your website.
Firstly install IIS server like "this".
Next you should create a virtual directory in IIS. See "this" . (in physical path, select the path upto your deployment folder)
Now run the website. If your problem is solved it means the issue is with the virtual directory in your remote server. So report them.
I have an issue where a dll shown twice in the Modules debug window for my WCF service (hosted by an IIS Project).
They are both loaded from my "Temporary ASP.NET Files" folders.
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\d9bf3211\b2544e2b\assembly\dl3\4cfa5823\28f464b9_9a03cd01\InversionOfControl.DLL
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\d9bf3211\b2544e2b\assembly\dl3\4cfa5823\2457a584_9803cd01\InversionOfControl.dll
The paths are almost exactly the same, but the folder name that holds the dll is different.
So here are my questions:
What is "Temporary ASP.NET Files" for?
Why not just reference the dll that is in my build folder.
How could I have gotten two?
How can I prevent it from happening again?
If I just delete them will this problem be "fixed"?
The ones in bold are the answers I am most interested in.
You can feel free to delete anything below Temporary ASP.NET Files. All of the contents will be generated again (albeit with an initial performance penalty).
Also note that it is easier to use explorer to do this if you kill IIS temporarily. (iisreset /stop, delete the files, iisreset /start).
All you need to know different approaches for compiling your code by asp.net.
Do pre compile your code in order to avoid compiling and storing compiled files in temporary folders.
Hope this article will give you better answer for your questions. http://www.asp.net/web-forms/tutorials/deployment/precompiling-your-website-vb
Deleting them has no negative impact to your system.
.Net will just keep creating them slowly but surely filling up the drive. On dev machines, there are a lot of them. On servers... well, you shouldn't be deploying code to the server that requires compilation anyway.
Regarding whether it will fix your problem... maybe. Go for it.