Can someone please help with asp.net configuration error? - asp.net

I have an issue that is driving me nuts and I have tried everything I can think of to solve it.
I started gettting the following error when I tried to launch asp.net configuration from within all visual studio pro 2008 projects and websites.
"Server Error in '/asp.netwebadminfiles' Application.
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration."
I am not sure what I have changed to start getting this error.
The problem is not confined to a particular project as I started a basic project from scratch and get the same issue. I get the error on all projects and websites.
I can still run the projects from the local server without any problem.
I have done what the error suggests to no avail. Is there a setting somewhere I have inadvertently changed to get this problem?

Have you looked at machine.config and \Windows\...\CONFIG\web.config and noted when they were last changed?

just to close this off.
There is a backup of the machine.config and web.config files in the /CONFIG directory with _default on the end. I renamed the existing files to _old and copied the new files to machine.config and web.config and all is now good and the asp.net config launches as expected.

Related

Can't Access App_Code and App_Data on IIS

I just published my ASP.NET Website on IIS and have already configured it to be working, everything is running smoothly.
Except.. I can't accept the App_Data file where all my database information is stored. That might not be the only folder that i can't access but maybe possibly App_Code too? Where i place all my Data Access Object classes (CRUD).
I searched high and low on blogs, articles and stackoverflow but i still can't find the solution to accessing the folders.
I also read that by default certain file extensions are being blocked by IIS
These are some hopefully useful information..
It appears that App_Data and App_Code folders are empty..
Codes in Web.config file from Published Directory
Have some issues copying the codes..**
File Segments in IIS
ConnectionStrings in IIS
Error i'm getting..
Any help is appreciated..
Ok this is what you can try to isolate the issue.
Enable Failed Request tracing for the website for which you are seeing this failure.
This will help you determine where the error might be coming from.
Looking at the call-stack you provided, it seems that there is a different issue. I would suggest you to debug the web app on the server to understand what the problem is. Refer the instructions here: https://msdn.microsoft.com/en-in/library/mt621540.aspx

ASP.Net - It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

Getting this error on an intranet application we have running in our development environment, and I'm not sure where to go/look for a solution. The application used to work fine, however it is run on a shared server with another team of developers and we're having trouble tracking down the error (no updates were made to the application by my team, it suddenly stopped working).
We're running Windows Server 2003 and IIS 6.0. If I open the solution on my machine, however, I receive an error in Visual Studio solution points to this line in the web.config, however I believe this is a relatively standard setting and we actually have this running in another environment (same server/IIS set up)
<authentication mode="Windows" />
The error reads
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.
I've also changed the <system.web> section of the web.config on the server to include <customErrors mode="Off"/>, however oddly enough when I navigate to the site I am still getting the custom error page...
I'm relatively new to IIS and never worked with Windows Server 2003. Can someone help point me in the right direction either to get the actual error so display in the browser or how to fix the error given to me by Visual Studio?
Bring up project properties page in Visual Studio. Right-click on project node in Solution Explorer and click properties. Look for the Web tab and click the button to create a virtual directory.
In some cases this could be caused by creating another sub-folder in your project and you added another Web.config file which has the same filename as the other Web.config file in the root folder.
To resolve this error, rename your newly added Web.config file to another name.
In my case inside my web directory, I had an other web directory along with its own web.config file. When I removed that sub directory that was a complete website in its own my problem is fixed now.
Just had this issue ... turned out to be a result of allowing debug information to be produced when publishing the Web App.
Publish Web App - Settings - File Publish Options - Precompile during publishing (true) - Configure - Emit debug information. (Should actually read "Omit debug information")
Delete Debug subdirectory of project and republish
This can also happen when you create a publish folderprofile if you take the default location, which is app.publish folder under your project folder. VS then gets confused and thinks there's another web.config it has to reconcile when building. Why does microsoft allow you to shoot yourself in the foot like this? Moving the Publish FolderProfile to another location stops the error from occuring.
any how web.config should be in the root directory most probably it happens when you don't have the solution file for your project. Close VS open it once again and choose the direct folder. Note web.config file should be in root directory or if you want to in sub directory then copy the webconfig file and create a new config file in the root. Caution:if you have mentioned any path in config file that will be lost
I had this problem. I think I caused it to start happening by modifying some settings in the publish profile. Undoing those settings fixed my issue. Here's what I did:
Right click on the project and go to publish
In the publish tab, in the configuration row, click "configure"
go to the settings tab
expand File Publish Options
I unchecked all of the options that were there. (checking some of these is what i believe caused my problem in the first place)
I deleted the bin and obj folders in my publish directory.
I have VS2017

HTTP Error 403.14 - Forbidden Error when accessing website

So I have all the updated code, the entire solution builds. It works on everyone else's machine, however when I try and access localhost/extranet on my machine, it gives me this error:
HTTP Error 403.14 - Forbidden
Detail Error Info:
Module DirectoryListingModule
Notification ExecuteRequestHandler
Handler 0x00000000
Requested URL http://localhost:80/extranet/
Physical Path C:\svn\K2\trunk\appteam\web\Chatham.Web.UI.Extranet\
Logon Method Anonymous
Logon User Anonymous
Now I tried going into IIS7, and enabling directory browsing, this removed the error, but still didn't bring up my website. I also tried going in and disabling the default document, re-enabling it, everything, nothing worked. I've also restarted IIS a few times to no avail.
Any ideas?
It sounds like your IIS is not processing the routing rules for your application and is trying to find a default.aspx, index.htm, etc. Since it cannot, it is wanting to display the directory listings (which is why you were getting the 404.14).
I just checked my dev setup and I think that your AppPool has to be set on Integrated as opposed to Classic on the Managed Pipeline for the AppPool. I have ran into this before, there may be ways to use the Classic Pipeline, but this would/should be the quickest way to resolve your issue. To check/change the pipeline mode, click on Application Pools from the menu on the left side of IIS, find your AppPool and look in the managed pipeline column. If it is set to Classic -> Right click the AppPool, choose basic settings, then change the dropdown from Classic to Integrated.
If I am incorrect, someone please feel free to correct me on this in the comments.
Edit - Just to add, you can run an MVC app in the Classic Pipeline mode, but you have to do the IIS 6 tricks to get it to work properly. Mainly, you need to turn on wildcard script mapping for MVC to work in Classic mode, If not it expects an .aspx file (or similar) to exist for it to handle the execution pipeline over to .NET from IIS.
Causes this error is removed Global.asax file from your root directory of your site.
To solve this problem add a Global.asax file to your project.
See here: How to add Global.asax file to ASP.NET MVC4 project
In IIS, you need to find out which app pool your application is running from. Just right click the web application under Sites>Manage Web Site>Advanced Settings. The first property should be the app pool.
Now, click Application Pools. You should see a column called "Identity". Add that user to the ACL of the C:\svn\K2\trunk\appteam\web\Chatham.Web.UI.Extranet\ directory. If it just says 'ApplicationPoolIdentity', it can be a little tricky figuring out the user. If it's just running under DefaultAppPool, you can use IIS AppPool\DefaultAppPool.
My solution was because I didn't have ASP.NET installed via "Turn Windows Features on and Off" so it was simple. I figured it out by enabling directory browser and trying to go to my views folder which then gave a more descriptive answer and pretty much said that there was a problem with a module because ASP.NET is not properly installed. It then dawned on my to go and install it.
Change the 'start page' by right click on the page and select 'Set as Start Page' that you want to open first when the web application starts first. This might solve your problem. :)
Also make sure in IIS Application Pool settings that Enabled 32-bit Applications under Advanced Settings is set to FALSE. I spent hours trying to fix this and that was my issue. Windows Server 2012 IIS 8.5
I solved this problem by setting exact .net framework. My website was using v4.0 version of .net.
Workaround to handle the problem:
Open command line as an administrator
Go to directory "C:\Windows\Microsoft.NET\Framework\v4.0.30319"
Execute the following: aspnet_regiis.exe -i
Open IIS and change Pipeline Mode of Your application to Integrated
Hope this helps
In my case the HTTP Redirection feature was missing on the server (with IIS 10).
Adding the feature resolved the issue and the site started to load fine.

ASP.NET: Errors not viewable despite proper configuration

I'm having the classic (dare I say typical?) error on the ASP.NET production server, which tells me that I can't view errors. Below the error displayed below, are things I've already tried.
In IIS Manager (6.0), the application is located under one of the web sites in "Web Sites". It is indeed a web application, as opposed to a virtual directory (it has that gear icon).
When trying to view the error from the localhost (i.e. the server itself), it doesn't find the application on its path, even though the root web site works just fine from localhost. It is clearly not a firewall issue because first of all, the firewall is turned off, and second because the root web site works fine from localhost. Heck, I even tried connecting through telnet and that worked fine and dandy too, so it is most certainly and very clearly not a firewall issue.
Basically, I just need to view the error at all. I won't have to fix this problem if I can just see the error and fix it, because obviously there is something wrong in the code itself... I just don't know what, because IIS/.NET won't tell me.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
So what I've already tried is what the error message itself suggests by setting the customErrors thing to "Off". In fact, it always was on "Off" so I didn't have to change anything. I've made sure that the web.config XML is valid.
Another common reason for this error is that the .NET run-time is set to version 1.1, not 2.0. I've also made sure that this is correctly configured to 2.0.
I'm running it in an independent application pool, meaning that there are no other applications at all, much less 1.1 applications, on the same application pool.
I've made sure that EVERYONE can do ANYTHING to the files and directories in the application itself. I understand the security ramifications here, I'm just trying to get it working at all, and then I'll constrain the access rights afterward, one step at a time. But in any case, everyone can read those files.
Any help deeply appreciated. Thank you in advance.
The error is a .NET framework error so it finds the app, but there is a configuration error. What you could do is add some event logging code in APplication_Error handler in global.asax to trap these errors, or turn on health monitoring (<healthMonitoring enabled="true" />), which by default will log ASP.NET framework errors to the event log.
HTH.
Never got this working until I changed the application from a "sub-application" (I don't know the proper terminology) to an independent website with its own hostname. ASP.NET works in mysterious ways.

Could not load file or assembly 'AjaxControlToolkit' after upgrade to .net 4.0

I have a web application that I am attempting to upgrade to .net 4.0.
I took the application and opened it via Visual Studio 2010 Beta 2 and selected the upgrade path for that application. The application uses the AjaxControlToolkit. Now that the upgrade is complete when I attempt to access a page I get the error message: "Could not load file or assembly 'AjaxControlToolkit' or one of its dependencies. Access is denied."
I've tried:
Restarting my machine
Clean Solution
Removing all files in Temporary ASP.Net Files
Relaxing permsissions (added Everyone with Full Control) on the Bin directory, the Temporary ASP.Net Files directory
Removing and readding the reference to the AjaxControlToolkit DLL
The related web.config entries for the AjackControlToolkit are:
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
<controls>
<add tagPrefix="ajaxToolkit" namespace="AjaxControlToolkit" assembly="AjaxControlToolkit"/>
</controls>
</pages>
Any ideas as to what is occuring here/how I can fix this issue?
I had a similar problem but was able to resolve by granting full rights to the "Temporary ASP.NET Files" folder for my impersonation identity.
I realize there's already an accepted answer, but for anyone else coming to this page via a search on the error code....
Review the permissions of the user that you're trying to impersonate.
In my situation, I was only getting the error on my development machine, rather then on our staging or deployment servers. (For while I got around this by removing the 'identity' node from config in my dev environment and just adding the line in post-build so it wasn't a problem for anyone other than me..
In my environment we have a specific user that all our web apps impersonate when running. I had created the user account, but hadn't explicitly set its account permissions. When I added the user as an Administrator on my dev machine, this problem went away completely. (Not ideal, I know, but it "works for me", and has minimal harm since that user account is locked down on our 'real' servers anyways..)
I think the post about the Temp files in C:\Windows\Microsoft.NET\Framework64\v4.0.21006\Temporary ASP.NET Files[projectName] was on the right track.
I solved the problem by editing permissions to be sure that the ASP Impersonating user (found in the security section of IIS as the Anonymous user that the app should use when allowing anonymous access) had the proper security to the directory.
Solved the problem... Access Denied ussually points to a permissions issue.
I got this error message (although another dll file) when I reinstalled my ASP.NET application on a new Windows Server 2008 machine. I searched for a solution to this for hours, trying absolutely everything, but to no avail. Until I deactivated McAfee antivirus. When I did, everything worked like a charm.
Not 100% sure why this worked, but in the appropriate Temporary ASP.Net Files directory (located at: C:\Windows\Microsoft.NET\Framework64\v4.0.21006\Temporary ASP.NET Files[projectName]) I manually coppied the AjaxControlToolkit.dll.
I was then presented with additional DLLs that were missing, but upon manually copying them to this location also I was able to resolve these issues. Doesn't seem like the best answer, but it ended up working for me.
I tried giving my impersonated user full rights to the Temporary ASP.NET Files folder, but that didn't work. I remember in the past when I got this error that it did the trick.
I know the question poster tried this but it worked for me when I removed/added the AjaxToolKit in visual studio. I suggest trying everything he has done first. I hope this helps someone.
You can try this:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ . Just clean up all the folders and files from inside this folder and compile ur application. Happy coding!
Odd error. Is anything in your web.config file pointing to the AjaxControlToolkit with a public key token or other assembly specifications provided? That has happened to me, where a value changed or I changed from a reference in the GAC to a local reference...
HTH.
I was facing the same issue. After a lot of research I found out that I was using impersonation in the config file. I had to change the impersonation ID to a different user that was local to the server and it resolved the issue immediately.
Inspect the DLL's properties. If it states somewhere that "this file came from another computer", click the checkbox and "apply", to lift restrictions Windows has put in place.
Remember to also open "Visual Studio" with "Run as administrator" using context-menu [right-click].

Resources