Say I have this type of config:
Site 1 (with an AppPool)
Virtual Directory
Virtual Directory 2
Site 2 (with an AppPool)
I'm tring to get the Site 2 informations but the only thing I can get is the path to the folder.
Related
As part of installer code, we are trying to make changes to IIS (check and create virtual directory, followed by adding a section to its web.config file.
Installer was working fine till recently a strange error started haunting us and blocking the installer from proceeding
Error says /Core/Service/UserService failed. Reason: Filename: \?\ c:\website1\Core\Common\Service\userService\web.config Error: cannot write configuration file
Please note that "Default Web Site/Core/Service/UserService" is a virtual directory under
"Default Web Site/Core" virtual directory in IIS.
"Default Web Site/Core" has physical path of c:\website1\Core\Common whereas "Default Web Site/Core/Service/UserService" is created with physical path of "c:\website1\Core\Service\UserService"
Not sure why error is pointing towards wrong folder path for web.config.
Code we have used is like this
using (ServerManager mgr = new ServerManager())
{
//code to add virtual path to root website (default web site)
mgr.CommitChanges();
}
using (ServerManager mgrpolicy = new ServerManager())
{
Configuration config = mgrpolicy.GetWebConfiguration("Default Web Site","/Core/Service/UserService");
ConfigurationSection hndlesection = config.GetSection("system.webserver/handlers");
hndlesection["accessPolicy"] = "Read,Write"; //this value is dynamic based on installer input but hardcoded here for your reference.
mgrpolicy.CommitChanges(); //issue comes after this line
}
we are running this installer on .net 4.8 windows application where the above code runs as part of a class library pointing to namespace System.Web.Administration.
Installer user is always system administrator and thus has all privileges.
Using IIS 7.5 .NET Framework 4. I have a web page that needs to access a SQL 2012 Filetable folder. In IIS, I set up the file table folder as a virtual directory & in the connection, I'm using my active directory account login as the account to "Connect as...". I'm able to access the FileTable folder in windows explorer by going to it's location:
\\computername\sqlexp2012\filetabledb\filetabletb_dir
In IIS, if I right click on the virtual folder, and then click Explore, it opens up a Windows Explorer instance & displays the files there (lots of PDF files).
However, if I try to access the virtual folder directly (http://localhost/virtualfoldername) by right-clicking & going to Manage Virtual Directory, or access it through a web page (http://mywebsite/vname) I get the following error.
Error Summary
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related
configuration data for the page is invalid.
Detailed Error Information
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070032
Config Error
Config File
Requested URL http://localhost:80/virtualfoldername
Physical Path \computername\sqlexp2012\FileTableDB\FileTableTb_Dir
Logon Method Not yet determined
Logon User Not yet determined
Config Source
-1:
0:
If I go in to the Virtual Directory & go to Manage Virtual Directory --> Advanced Settings, I see the physical path to the SQL Filetable folder & Physical Path credentials. My user account is set up as dbo under Security --> Users. The IIS log file is not helpful, nor is anything in the Event Viewer.
Anything I've been able to find has said that it is likely permissions related, but using my account - which I know works, as far as accessing the file share via Windows Explorer - doesn't. Any thoughts welcome.
Thanks!
I have been doing C# application which can access Public Folders through Exchange Web Services Managed API.
But there is Microsoft.Exchange.WebServices.Data.ServiceResponseException which says There are no public folder servers available.
My public folders will be like this.
Folder 1 --> Subfolder1 | Subfolder2 | Subfolder3
Folder 2 --> Subfolder1 | Subfolder2
Folder 3
Folder 4 --> Subfolder1
The exception throws when the application access to Folder 2.
The application can access Folder 1 and display all 3 subfolders.
Exception throws here:
Folder parentFolder = Folder.Bind(folderID, foldView.PropertySet);
I have tried recursive traversal and other possible ways. But problem still remains.
Please help me! I will be very very grateful for your guidance
I got this error, because I did not set the credentials.
So please check if you have set the credentials.
exchangeService.Credential = new NetworkCredential("UserName","Pasword", "Domain");
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
I'm trying to encrypt the connection strings in my web.config. I'm following the instructions from Walkthrough: Creating and Exporting an RSA Key Container. However, when I get to the part with the command:
aspnet_regiis -pe "connectionStrings" -app "/MyApplication" -prov "MyProvider"
it keeps complaining:
"The configuration for the virtual path '/MyApplication' and site 'Default Web Site' cannot be opened
Failed to map the path '/myapplication'
Failed!
I'm fairly sure I've followed the instructions correctly. I created the project named 'MyApplication' directly in the 'C:' root.
Any ideas? Perhaps I should be following a different set of instructions?
Thanks for your answers. Turned out I needed to run the command prompt as "Administrator"
Did you add the MyApplication folder as a virtual directory in IIS under the default web site? That seems to be what it's looking for, not a folder path...
According to this MSDN post, you can use -site to define the site to target. An excerpt from that site:
Use the –app option to identify the application for which the
Web.config file will be encrypted and the -site option to identify
which Web site the application is a part of. The Web site is
identified using the site number from the Internet Information
Services (IIS) metabase. You can retrieve the site number from the
INSTANCE_META_PATH server variable in the ServerVariables collection.
For example, when IIS is installed, a Web site named "Default Web
Site" is created as site 1. In pages served from that site, the
INSTANCE_META_PATH server variable returns "/LM/W3SVC/1". If you do
not specify a -site option, site 1 is used.
/MyApplication is a virtual path and the message seems to indicate that path is not available i.e. there is no http://localhost/MyApplication. Did you forget to create virtual directory for your app in IIS?