Mag Web Technologies is a Software Development Company offers on & offshore Software Development Services. Mag Web Enterprise IT services deliver excellence to new age IT businesses. Explore new possibilities of enterprise automation.
Saturday, 2 February 2013
Access and Modify ASP.NET Configuration Files Remotely
The System.Configuration and System.Web.Configuration types allow your application to access the configuration files on a remote server. In particular, you can open and modify the Machine.config or a Web.config file in any Microsoft Internet Information Services (IIS) application or its child directories on a remote server. This topic:
Demonstrates how to set the remote server to allow a client computer to access the server configuration files.
Provides a console application, to run on the client computer, that can read or modify the server configuration files.
Discusses the security considerations to take into account.
To access configuration files on a remote server, the client computer must be able to communicate with the server. To enable this communication, a remote configuration component must be installed on the server.
The client computer then accesses the server configuration files by calling the ASP.NET configuration API through the remote configuration component. For more information, see Editing ASP.NET Remote Configuration Files.
Note
If the requested configuration file does not exist, the .NET Framework, running on the server, returns a configuration file consisting entirely of inherited settings that apply to the specified path. If your application requests an update, a new file is created. When running the console application, you must enter a valid server name. This is because ASP.NET passes this name directly to the operating system. You must likewise enter a fully qualified user name with the domain name prefix.
To set up the remote server
Install the remote configuration component on the server using the ASP.NET IIS Registration tool (Aspnet_regiis.exe) with the config+ command, as shown in the following code.
Aspnet_regiis config+
Programmatically or manually, make sure that the Web.config file of the IIS server's "Default Web Site" contains values similar to the following:
<appSettings>
<add key="keyName1", value = "this entry value"/>
<add key="keyName2", value = "this entry value"/>
<add key="keyName3", value = "this entry value"/>
</appSettings>
To update the remote configuration files using a console application
Run the console application provided in the code example below to update the Web.config file of the Default Web Site on the remote server. This example assumes that the user running the client application has administrative privileges on the remote server. You can use either of these two commands.
>remoteconfiguration machineName
>remoteconfiguration machineName domainName\userName password
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: only a member of this blog may post a comment.