Not able to configure IIS 7 for ASP.NET 3.5 app

2019-07-22 13:22发布

问题:

I developed a small ASP.NET 3.5 app. with only few pages and no DB connectivity. I am trying to publish it, but my website gives error:

**Parser Error Message:** 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.

**Source Error:**

Line 45:             
Line 46:         -->
Line 47:     <authentication mode="None"/>
Line 48:        <!--
Line 49:             The <customErrors> section enables configuration 

I am using Windows 7 with IIS 7. When I add a new website in IIS there are a few concerns here. Below are the images that show that something is wrong underhood:

  1. While creating new application pool for an application built on .NET 3.5, I could not see the .NET Framework 3.5 in the list:

  1. When I open the Add Website dialog, and click Test Settings, it gives this error:

Please let me know how to fix this issue. I also want to know whether I have to add a website or add a virtual directory?

回答1:

from the error message you provided, you have to have a virtual directory defined for your app with the pysical path pointing to your ASP.NET app folder, and also have the virtual dir as an application ("Convert to application" in the context menu of the virtual dir node, i think).

you dont need to create an app pool , but its probably a good idea. also the registration issue that the guys here explain is also a must.



回答2:

You have to register .Net framework for IIS using aspnet_regiis -icommmand?