Issues with precompiled website and server control (parser error) - asp.net

I am deploying our system to a brand new server that was previously untouched and having serious issues with .NET (the error points to server controls but i think this is a symptom rather than the problem)
Basically the VB6 code seems to work correctly but when moving over to the .NET I keep getting a parser error when loading the server control.
Like this
Im quite sure that the server control isnt the issue and there isnt an issue with the compiled code. I have copied the code over from a working deployment on another server.
The code is organised as a WebSite rather than Web Application
The control is referenced at the top of the aspx page like so
<%# Register Namespace="CustomWebControls" TagPrefix="Fastrack" %>
CustomWebControls is in the App_Code folder and is compiled into App_Code.dll
I think there is some issue with windows or IIS config stopping the reading of the compiled app_code.dll file. I have checked user permissions and allowed all to access i have manually copied over the dlls to the asp temp folders.
Other things tried
reinstalled IIS
reinstalled .NET
checked web and machine.config files against known working ones
checked iis installed components are correct
I'm completely out of ideas with this one and I'm not sure where to go next.
The stack trace disappears off deep into System.Web.UI and doesn't hint at any issues with our code at all (doesn't even seem its getting as far as loading it)
Platform
Windows 2008 R2
IIS 7
.NET 4
ASP.Net webforms
If anyone has any suggestions or would like some more info from me let me know.

After much ripping out of hair and sleepless nights the anser was a missing precompiledApp.config file!
The hardest ones often have the simplest answers!

Related

ASPX Page Not Found (Error 404), though it exists?

I have a C#.NET project and am having a problem with a single web forms, ASPX page when debugging my application. Most of my application works fine, but when I hit a particular page, I get an Error 404, resource not found. I don't understand this because the file does exist, and it exists in the path that is being referenced. And, I hit several other ASPX pages on the way to this one, without error.
Now, I should mention that this particular page was only recently added to the project. My coworker, who added the page, says he was able to get the page to work, but we have different environments. So, I'm sure that has something to do with it, but I don't know what. Below are the known details regarding the differences between our environments.
My environment
Windows 8.1
IIS Express
Visual Studio 2013
Co-workers environment
Windows 7
IIS 7
Visual Studio 2012
We are both running with the same source code, as well as the same site and application pool settings in IIS, which are pointed to run time 4.0 and in classic mode.
Does anyone here have any idea why this would happen, or what I might try to get past this?
I ended up fixing this by switching to local iis and enabling the Static Content option in Windows Features.

WebResource.axd - works on one computer; gives 404 on another

Situation:
We created an assembly with our own ASP.NET control.
That control registers some resources (images, JavaScript files, etc);
There is a web-application which uses our control.
The control is loaded well and get access to internal resources. In result HTML code all calls to resources look like "/WebResource.axd?d=...".
So far, so good.
We have two computers: first - Win7 32 used for development, second Win7 64 - for testing.
The problem:
The assembly generated on Dev machine works well on it but give 404 error for all requests to WebResource.axd when running on Testing computer.
If we just copy the sources to Testing computer and build our assembly there - it works well on both computers.
We use .NET 4.0. All latest updates are installed on both computers. Web application which uses our control runs right from VS 2010 (under ASP.NET Development Server).
Any suggestion?
We've found the problem.
Our testing computer had wrong date/time set (10 days before the real date). So our assembly (built on development system) was considered by it as a "DLL from the future".
And it seems ASP.NET can stand the assembly "from future" but it does not like "future" resources placed into that assembly.
Once we corrected date setting on the testing system - everything started to work well.
Hope this case will help somebody else.
The assembly with your asp.net control may not be included in your web application deployment.
Look for the reference to your assembly in the web application, right click it and select properties.
Look for the copy local box, and set it to true.
recompile the application and redeploy it to the other machine.

Website is running a cached dll somehow after changing it

The situation is I made a minor bug fix to a class, so they want to just deploy the dll affected. They stopped IIS, replaced the dll in the /bin folder of the iis directory for the web site with the new one I gave them, and started iis again. There are multiple servers, but they just changed it on one to try it out. They are still seeing the same error in the eventlog of the server in question. Looking at the stack trace I can tell it is running the old dll.
They've checked the GAC and don't see it there.
I've checked the dll with reflector to verify I gave them the correct new dll.
This is an asp.net 2.0 website and the server is 2003. I'm not sure how it was deployed originally but it has a copy of the old dll in C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\NAME_services#################\assembly\dl3###################\ and in D:\xxxx\Sites\NAME\Services\obj\Release. Could it be using one of these or building the old one or even just caching it in memory?
Nuke your temporary asp.net folder contents. Not sure why the update didn't automatically get compiled, though.
We had same problem but with minor complications, we have many many sites so a "clearing all temp" and restart IIS is not a good option for us. So we needed to be more selective in what to force a refresh on.
On our QA machine, under ... "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files"
I did a file explorer search for the partial file name of what we are trying to release. The file was found in a folder something like:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\4503212x\ad95664x, so I stopped app pool, deleted the folder, restarted and all was deployed then - great!
But .... We had same trouble deploying to production and the above did not work.
Long story short, the QA app pool was set to "enable 32 bit true", but production was set to "False" so the prod temp files resided in:
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319" instead (\Framework64\ instead of \Framework\ ).
If clearing temp files is not working - double check your frameworks, or look for files to refresh at the C:\Windows\Microsoft.NET folder level and below. you may be surprised.
You don't have to stop IIS to deploy your update, you just copy them over.
Also, if they copied only the DLL but your fix was in the .aspx file, then it won't show up. You should really do a full deployment.
We copied the project source code to a new folder and reopened the solution. This somehow tricked Visual Studio into not using the cached version of the DLL. Wish we knew why this worked, but that resolved it for us.

VS ASP.NET 500 Server Error

Hey guys, I'm having a super weird problem with my VS 2008 solution.
We had this hand-coded ASP.NET compiled web app on our old IIS6/Win2003 server, working great, moved it to our new IIS7/Win2008 server, still working great, but when I try to compile the application and publish it again to our new Win2008 server, I get server 500 errors. It's ASP.NET 2.0 with AJAX extensions and AJAX control toolkit.
I'm not too great with server issues, or even sure if it is a server issue but here are some more symptoms... ?
I know the website works (it only differs by some minor code fixes) and can use it's code on a development machine, there are no errors, and it publishes fine. Publishing (using the DLL files), and even not publishing and trying to use the code-behind files on our new server, both no success. The old website does work on the new server just fine.
If I put a simple hello world html page in the website's virtual directory, with the old code, it works fine, but with the new code, that html page gets the 500 error. And in fact, oddly, I can add all the files to the website, only when I add the web.config, do I get the 500 error. The web.config has not changed.
Tried stopping and restarting IIS
What's the problem, here? Any ideas, what else can I do to troubleshoot the problem?
Check what IIS7 is running under .NET 2.0 or .NET 3.5?
Its tough to see without being there, have you checked which App pool the server is running the site on? (default should be OK, I have found some to be set to classic which causes problems with the AJAX control toolkit)
Also you could try aspnet_regiis -i (if the server is 64 bit make sure you run the one under the 64 bit version of .net)
It was a IIS 7 to 8 issue.
Both machines have different assemblies that need to be just-so on the web.config, in addition with IIS7 web.config changes to make AJAX happy (it has new XML sections).

Could not load type 'XXX.Global'

Migrating a project from ASP.NET 1.1 to ASP.NET 2.0 and I keep hitting this error.
I don't actually need Global because I am not adding anything to it, but after I remove it I get more errors.
The reason I encounter this issue is because I change the build configuration. When I set a web project to x86, it changes the output path to bin\x86\Debug. However, the output path should be bin and the web server won't find the binaries because of this.
The solution thus is to change the output path of the website back to bin after you change the build configuration.
There are a few things you can try with this, seems to happen alot and the solution varies for everyone it seems.
If you are still using the IIS virtual directory make sure its pointed to the correct directory and also check the ASP.NET version it is set to, make sure it is set to ASP.NET 2.0.
Clear out your bin/debug/obj all of them. Do a Clean solution and then a Build Solution.
Check your project file in a text editor and make sure where its looking for the global file is correct, sometimes it doesnt change the directory.
Remove the global from the solution and add it back after saving and closing. make sure all the script tags in the ASPX file point to the correct one after.
You can try running the Convert to Web Application tool, that redoes all of the code and project files.
IIS Express is using the wrong root directory (see answer in VS 2012 launching app based on wrong path)
Make sure you close VS after you try them.
Those are some things I know to try. Hope one of them works for you.
I've found that it happens when the Global.asax.(vb|cs) wasn't converted to a partial class properly.
Quickest solution is to surround the class name 'Global' with [square brackets] like so (in VB.Net):
Public Class [Global]
Inherits System.Web.HttpApplication
...
Deleting the existing global.asax file and adding a new one, clears out this error. This has worked for me many times.
If your using visual studio 2010 this error can occur when you change the configuration deployment type. The 3 types are x86, x64 and Mixed mode.
Changing to mixed mode setting for all projects in solution should resolve the issue. Don't forget to delete the bin, Lib files and change the tempdirectory output if your an ASP.NET website.
This just happened to me and after trying everything else, I just happened to notice on the error message that the app pool was set to .Net 1.1. I upgraded the app to 2.0, converted to web application, but never changed the app pool:
Version Information: Microsoft .NET Framework Version:1.1.4322.2490; ASP.NET Version:1.1.4322.2494
This one drove me completely insane and I couldn't find anything helpful to solve it. This is probably not the reason most people have this issue but I just hope that someone else will benefit from this answer.
What caused my problem was a <clear /> statement in the <assemblies> config section. I had added this because in production it had been required because there were multiple unrelated applications on the same hosting plan and I didn't want any of them to be affected by others. The more correct solution would have been to have just used web config transforms on publish.
Hope this helps someone else!
Changing the address's port number (localhost:) worked for me :)
I fixed this error by simply switching from Debug to Release, launch program (It worked on release), then switch back to Debug.
I tried just about everything else, including restarting Visual Studio and nothing worked.
I had this same problem installing my app to a server. It ended up being the installer project, it wasn't installing all the files needed to run the web app. I tried to figure out where it was broken but in the end I had to revert the project to the previous version to fix it. Hope this helps someone...
In my case, a AfterBuild target in the project to compile the web application was the reason for this error.
See here for more info
Removing Language="c#" in global.asax file resolved the issue for me.
In my case, I was duplicating an online site locally and getting this error locally in Utildev Cassini for asp.net 2.0. It turned out that I copied only global.asax locally and didn't copy the App_code conterpart of it. Copying it fixed the problem.
When you try to access the Microsoft Dynamics NAV Web client, you get the following error.
Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
This error can occur when there are multiple versions of the .NET Framework on the computer that is running IIS, and IIS was installed after .NET Framework 4.0 or before the Service Model in Windows Communication Foundation was registered.
For Windows 7 and Windows Server 2008, use the ASP.NET IIS Registration Tool (aspnet_regiis.exe,) to register the correct version of ASP.NET. For more information about the aspnet_regiis.exe, see ASP.NET IIS Registration Tool at Microsoft web site.
try this solution
https://www.youtube.com/watch?v=LNwpNqgX7qw
Ensure compiled dll of your project placed in proper bin folder.
In my case, when i have changed the compiled directory of our subproject to bin folder of our main project, it worked.
Had this error in my case I was renaming the application. I changed the name of the Project and the name of the class but neglected to change the "Assembly Name" or "Root namespace" in the "My Project" or project properties.
Deletin obj, bin folders and rebuilding fixed my issue
I had this problem.
I solved it with this solution, by giving CREATOR OWNER full rights to the Windows Temp folder. For some reason, that user had no rights at all assigned. Maybe because some time ago I ran Combofix on my computer.

Resources