简体   繁体   中英

IIS 6 Virtual Directory created without the asp.net application extensions

I have a configuration page that needs to create a virtual directory under a new virtual application. The method for creating this directory is distinct for the version of IIS, with the IIS 7 installs using the newer management controls. The IIS 7 installs create the virtual directory and add the expected asp.net application extensions. The following code, used for IIS 6, does create the virtual directory, however it does not add the asp.net application extensions as you can see in the image below. How do I modify my code to ensure the expected asp.net application extensions get added?

在此处输入图片说明

private void AddDirIis6(DirectoryEntry entry)
{
    var child = entry.Children.Add("EditorControls", "IIsWebVirtualDir");
    child.Properties["Path"][0] = "directory\EditorControls");

    child.CommitChanges();
    entry.CommitChanges();
}

It looks like the script mappings are missing for your site. You can either run

aspnet_regiis -s W3SVC/1/ROOT/SampleApp1

with your application specified for the last parameter instead of the sample one or

aspnet_regiis -i

Be aware that -i installs the script maps for ALL sites on IIS.

You will need to execute the aspnet_regiis for the correct version of the framework you are using. Instructions to do this are in the instructions for the aspnet_regiis tool: http://msdn.microsoft.com/en-us/library/k6h9cz8h(v=vs.100).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM