Last post Feb 28, 2014 07:53 AM by farm boy
Feb 26, 2014 12:38 PM|farm boy|LINK
I'm using Visual Studio 2013 Pro and I have also installed IIS 7.5 on a Windows 7 Pro 64 bit machine.
My asp.net 2.0 / SQL Server 2012 website is running perfectly on my hosting service but I get errors when I try to run it on my local machine.
After downloading the database and website code to my local machine, I restored the database and put in and tested a new connection string.
Now, when load the website into Visual Studio and use Ctrl-F5 I get the following error:
Error 1 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. D:\ORMF\wwwroot\web.config 32
Line 32 in the web.config : <sessionState mode="Off" />
I have been trying to fix this problem for the last six hours and have run out of ideas.
Any clues anyone?
Feb 26, 2014 01:11 PM|PatriceSc|LINK
You have created a site pointing to your files ? Make sure you defined the application root for your web site. You could likely use IISExpress which doesn't require much config and could be enough.
Basically the issue is that likely that the location of the web.config file is currently not considered as an application root. As a result it is considered as a folder level configuration file and it doesn't make sense to configure session settings at this
level so it ends up with this error.
Feb 26, 2014 01:41 PM|farm boy|LINK
Thanks for your quick reply. Unfortunately I have not used IIS at all over the past few years so I would appreciate a bit more "how to" guidance.
Make sure you defined the application root for your web site
I tried to do this earlier today but what I did had no effect - I still got the same error.
Part of the problem is that I'm floundering around not really understanding what I am doing.
You could likely use IISExpress
Hmm - I don't think that IIS Express is installed on my system.
However, I do have IIS 7.5.7600.16385 installed and this is what I used in my seemingly abortive attempt to define the application root.
I'm wondering if I pointed IIS at the wrong folder level?
What I started with was:
Now, as a result of my blundering around I have a second web.config that is at the same level as wwwroot with the following code in it:
<?xml version="1.0" encoding="UTF-8"?>
<directoryBrowse enabled="true" />
Could you please suggest what I should try next?
Feb 26, 2014 01:49 PM|farm boy|LINK
You have created a site pointing to your files ?
Sorry, I missed this because I'm not exactly sure what it means.
In my first attempt, I used IIS to create a new site by using Sites>Add Web Site
But I wasn't sure what I should put in each field of the Add Web Site dialog box.
Maybe I just guessed wrong?
Later, I read somewhere that all I needed was the DefaultWebsite so I deleted the site that I had added
Feb 28, 2014 07:53 AM|farm boy|LINK
OK - I found and fixed the problem.
There was a second asp.net application with a second web.config installed in a folder under the main wwwroot folder.
It was the web.config of the second application that was causing the problem.
When I removed the second application, everything worked as it should.
The confusing bit was that the application runs just fine on the hosting service - even with the second application.
Thanks for the tip.