C# - Differentiate Between ConnectionStrings In The Machine.config And Web.config

Jan 13, 2011

Using C#, is there are way to differentiate between ConnectionStrings in the machine.config and the web.config? I would like to iterate over the collection in the web.config but not those from the machine.config. ASP.NET 3.5, C#

View 4 Replies


Similar Messages:

C# - Why Does The System.configuration Differentiate Between Web.config And App.config

Jan 15, 2010

While using a third party dll I was getting the following exception - "exePath must be specified when not running inside a stand alone exe" with following trace

System.Configuration.ConfigurationManager.OpenExeConfigurationImpl(ConfigurationFileMap fileMap, Boolean isMachine, ConfigurationUserLevel userLevel, String exePath).

The reason I found was that it was looking for app.config and I had provided the details in web.config. My question is why does the system.configuration differentiate between web.config and app.config.

View 2 Replies

Visual Studio :: Errors In Root Machine.config And Web.config After 2010 Installation

Jan 19, 2011

I just installed VS2010 and opened the root machine.config and web.config files for review and I found some errors. In machine.config, the following line has errors in both entries for <Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior>. When I hover the cursor over them I get a tooltip text which displays: "The element 'endpointBehaviors' has invalid child element 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior'. List of possible elements expected: '...(list of options here)...'. The same problem happens for the second appereance in tag <serviceBehaviors>.

[Code]....

In web.config, there is a tag called <protocols> that has an error with a tooltip text that says "The element 'system.web' has invalid child element 'protocols'. List of possible elements expected: '...(list of options here)...'.

View 2 Replies

Machine.config / Web.config In .NET Framework 3.0 / 3.5 And Framewor 1.1 / 1.0 Cascade?

Aug 9, 2010

I made a change in my machine.config for a 1.1 application and then later I upgraded the application to .Net Framework 3.0/3.5. Will that configuration change still apply or do I have to make that change in my local web.config for the 2.0 machine.config/web.config?

View 1 Replies

Configuration :: Web.config-connectionstrings

May 11, 2010

I use visual studio 2008 login controls to build up a login web page and have a hosting MS SQL with godaddy. After the login page is finished, I went to server explorer to publish DB to provider and save it in .sql. Then I went to godaddy hosting and executed the exported query. I also added the following connectionstrings to the web.config

<connectionStrings>
<remove
name="LocalSqlServer"/> [code]....

When I run the website, I received the following error

Configuration Error

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

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:
[Code]....
Question 1: I have also copied membership,profile,rolemanager from .NETconfigmachine.config to web.config but it didn't solve the error.Question 2: Can I use this built in control with its express DB or I have to create one by my own? What should I do in web.config for connectionstrings?

View 6 Replies

C# - Encrypting ConnectionStrings In A Web.config File?

Feb 4, 2011

Any section in my web.config file that I want to encrypt I run this command line util:

aspnet_regiis -pe "anySection" -app "/SampleApplication"

It all works just fine until I try encrypt my connectionStrings sections

I define (and I cannot change this) my connectionStrings section like this:

[code]....

Is there a way of doing this using the aspnet_regiis util? Doing it with code is not an option for me.

Also is there a way to run this untility without specifing the application (-app "/SampleApplication") instead giving the path to the web.config file?

View 2 Replies

Security :: How To Encrypt The ConnectionStrings In File Web.config

Mar 15, 2011

I fully followed the steps in this page [URL]

look at the step 5 at "Using the Example Provider in an ASP.NET Application" element , I entered the command "

aspnet_regiis.exe -pe "connectionStrings" -app "/SessionState" -prov "TripleDESProvider"
" at the windows command line, it asked me "The protection provider 'TripleDESProvider' was not found"

I make sure the files keys.snk and keys.txt are in the same folder and the file web.config is correct. Who can tell me the reason for the error and how do I handle with it?

View 2 Replies

Machine.config File Know About Web.config?

Feb 16, 2010

It is known that we use web.config file to override the setting of machine.config file.

a) how come machine.config file knows that only changes made in web.config file are to be overwritten. I mean to say, if I use some other name for the config file say xyz.config, will it be able to work?

b) How does machine.config file know about web.config? Is there any link mentioned inside the machine.config file for that?

View 1 Replies

Security :: Unable To Encrypt Web.config ConnectionStrings In Web Application Project

Nov 28, 2010

I'm all set on the server side with the RSA key pair installed. Where I'm hung up is trying to get the job done on the web.config file ... can't seem to get the aspnet_regiis command string right. I am using the command string provided by the web host (DiscountAsp.net). Most (all) of the examples I read use a website on the development machine. I actually registered my project in IIS and tried that but it didn't work. In any case I would rather not have to go to the hassle of registering a project in IIS anyway if I can avoid it.

Details:

My web application project is in a folder on my local machine:

D:Projects<project name>

This is most recent (failed) attempt to use aspnet_regiis:

C:WINDOWSMicrosoft.NETFrameworkv4.0.30319aspnet_regiis.exe -pe "connectionStrings" "D:Projects<project name>"

Is it possible to just do this manually by looking at the NetFrameworkConfigurationKey_xxxxx.xml file and entering the values? Seems like it should be do-able except I'm not sure how to parse the xml file for the correct values.

On a related note, when I add the following code to web.config it "announces" that "The keyContainerName attribute is not allowed". Ditto useMachineContainer

[Code]....

View 2 Replies

Why Can't Add Section To Machine.config

Mar 31, 2011

I would like to add this section to my machine.config in exactly the same way many articles and microsoft are suggesting:

<configuration>
<system.net>
<connectionManagement>
<add name = [URL]/>
<add name = "*" maxconnection = "2" />
</connectionManagement>
</system.net>
</configuration>

[URL] As soon as I do it though, I get this exception when trying to hit a page hosted on the IIS on the same machine: Parser Error Message: Unrecognized configuration section system.net. Source Error:

Line 9: settings that differ from their defaults.
Line 10: --><configuration>
Line 11: <system.net>
Line 12: <connectionManagement>
Line 13: <add address="*" maxconnection="24" />

Source File: C:WINDOWSMicrosoft.NETFramework64v2.0.50727Configmachine.config Line: 11 Where is the problem and how can I modify the machine.config so that I can finally control the maxconnection value?

View 3 Replies

Create App.config Only For Developer Machine

Feb 22, 2010

Can I create app.config or web.config file that applies only to my developer machine, as opposed to using the default configuration files that are checked into source control?

View 7 Replies

Machine.config And Processmodel With IIS Express

Jan 21, 2011

I'm wondering if modifying processModel in machine.config will have any effect on an IIS express integrated mode application? I'm trying to modify the maxWorkerThreads to at least 100 because I was comparing normal IIS vs IIS express on windows 7 using WCAT to see if scott was correct when he said IIS express has no connection limits. Although IIS express does show 30+ requests executing at the same time against the normal IIS limit of 10 the actual total requests per seconds are comparable between both and IIS express has much higher cpu usage and on average 70 requests queued vs 0 requests waiting for normal IIS! And the CPU is only about 70% on an quad core i7. surely there is room for optimization? additional details. I have uploaded the WCAT results run on windows 7, same script, to [URL]

IIS Express has slighter higher requests per second, and total transactions served than normal IIS. IIS Express is executing up to 50 requests at a time, while normal IIS on windows 7 is limited to 10 as designed. IIS express is using 30% higher cpu, probably because of additional requests it handles at a time. But on average Express requests take much longer to complete. see Request Execution Time performance counter and time analysis (first and last byte). Express is only able to beat IIS in total requests served because it can handle more requests at a time!

Could the fact that IIS express is printing each request to command line window even with trace set none be slowing it down. I also noticed a lot of additional modules registered in IIS express applicationhost.config that are not in IIS applicationhost.config. Could then extra debugging/tracing modules be causing the problem. I notice IIS express does not have FileCache and HTTPCache modules. Could that be why? I'm hoping asp.net experts can clarify how these results are possible if IIS express is not limited.

View 1 Replies

What's Machine Config - Trying To Keep Each Connection String For Each User

Mar 9, 2010

I am doing a web project in asp.net. Now I am trying to keep each connection string for each user. And the user can decide which server he prefer. How to change this dynamically and where can I store this?. I happen heard about machine.config .Unfortunately i am not familiar with this. Can you just tell what it is and it's use.

View 3 Replies

Visual Studio :: 4 Doesn't See Machine.config

Mar 23, 2010

I have switched over from VS2008 to VS10 (.Net4) and I program in Silverlight. But this problem isn't related to the Silverlight but more so to ASP.Net and that's why I bring it up here. My problem is if I create a SL or even a plain ASP.Net Web app, and I go to Project|ASP Configuration and click on security I get error that it can't find the database. After lots of testing, it turns out if there is no connection string with the name "LocalSqlServe" in my web.config, it does not find Machine.Config in the .Net Framework to get it's default. It also happens at runtime and not just in VS. So, my machine ASP.Net can't find machine.config file. I'm running Vista 32.

View 3 Replies

Configuration :: Apps Automatically Using Machine.config

Oct 31, 2010

I have connection strings info in web.config. I thought that if this were the case, machine.config would be ignored. But, everytime the connection string in web.con is different than the connection string in maching.con, I get error. The connection name 'aspnetdbConnectionString' was not found in the applications configuration or the connection string is empty. Is there something I can check or change to get the app to ignore the machine.config when web.config connection string is listed.

View 4 Replies

Storing Configuration Data In .NET Than The Web/machine Config?

Jun 24, 2010

We have a large multi tenanted website which requires thousands of lines of web.config to support it. As the system grows we are finding it more and more difficult to manage this configuration file.The system currently in place uses XSLT to generate the config but this solution seems to involve a lot of duplicated code (we have 12 deployment environments).

I am leaning towards putting the configuration data in the db so we can be sure that it's deployed with the application and that our release notes don't require the IT guys messing around with XML

What are better solutions we could use?

View 3 Replies

Configuration :: Decrypting Web.config In Differenct Machine

Mar 15, 2010

We have a problem regarding decrypting the web.config... We encrypted the web.config in computer A. but we need it to decrypt it in computer B.

we got an error

"Failed to decrypt using provider 'DataProtectionConfigurationProvider'. Error
ssage from the provider: Key not valid for use in specified state. (Exception
om HRESULT: 0x8009000B) (D:WCFSearchweb.config line 17)

Key not valid for use in specified state. (Exception from HRESULT: 0x8009000B)
Failed!"

we also tried the RSAProtectedConfigurationProvider and we're not able decrypt also...

I search google and found this unfortunately we can't decrpyt it... How do i include the key? do i need to copy and paste it?

View 6 Replies

Is Normal That None Of The .net Framework Versions Contain A Machine.config File

Mar 30, 2011

I am trying to tune IIS to reduce contention, and following many articles on the .net I am trying to locate this in the file to no result:

<system.web>
...
<httpRuntime minFreeThreads="8" minLocalRequestFreeThreads="4" ... />
....
<processModel maxWorkerThreads="20" maxIoThreads="20" ... />
....
</.system.web>

Is it normal that none of the .net framework versions contain a machine.config file that contains the above settings?

View 3 Replies

Two Machine.config Files On Server - Which One To Edit And Verify They Are Being Used?

Jul 15, 2010

I need to do some performance tuning and need to modify the following settings: processModel, httpRuntime, and connectionManagement. Simple enough I suppose, but I'm not sure which of the two machine.config files to edit, or do I edit both?

Windowsmicrosoft.net Framework v2.0.50727CONFIGmachine.config
Windowsmicrosoft.net Framework64 v2.0.50727CONFIGmachine.config

As a follow up question, how do I verify that the settings have been applied? I should mention that the server is running Windows Server 2003 Enterprise (64-bit) with IIS 6.0 (64-bit) and MSSQL Server Enterprise 2005 (64-bit).

View 2 Replies

Configuration :: Unable To Access Connection String In Machine.config

Nov 14, 2010

I have a Windows Service I have developed in Visual Studio 2005 (C#).

It accesses a database using a connection string in machine.config.

On my Windows XP Pro 32bit (SP3) machine, it works correctly.

On my new Windows 7 Pro 64bit machine, it throws "object not set to an instance of an object" when it gets to the line where it's trying use the connection string.

This is the 'object' which is not set in Windows 7:

ConfigurationManager.ConnectionStrings["MyDatabase"].ConnectionString

The machine.config has the same connection string set up on both machines.

A .Net 2 website transferred to the Windows 7 machine has no problem accessing the same connection string.

I have tried a bunch of different permissions on the machine.config and its containing folders, and setting the service to log in as Admin, but I don't know exactly what permissions are required.

View 1 Replies

Configuration :: Web.config Differences On Local Machine / Failed To Map The Path '/'

May 23, 2010

I am loading the config file programaticality so that i can edit it but ive hit a hitch in that when i debug it through VS i get the following error:

An error occurred loading a configuration file: Failed to map the path '/'.

My code is:

[Code]....

I use it in other sections of my site and know that it works as intended when it is deployed to my webhost. I am having issues with another section where I use it so I want to step through it to debug, what do I change this "~" to, to correctly reference the config when I am debuging locally.

View 2 Replies

Installation :: Access Denied To Machine.config - Windows 7 Development Environment

Mar 14, 2010

I have just ported my VS2008 development environment to a new computer running Windows 7. One roadblock I'm having is that when I edit machine.config in VS2008, I cannot save it back to its location - I get an error saying Access Denied. I am logged in as Administrator and have tried to set myself up as owner but the crazy security rules in Windows 7 are frustrating this operation. (I could do this on my previous system - VS2008 running XP.) I set the Administrators permissions to Full Control and made this file's owner Administrators (vs the previous SYSTEM)

View 5 Replies

IIS Configuration :: Web Config Error - It Could However Be Viewed By Browsers Running On Local Server Machine

Jun 5, 2013

When I run my application I got this error

Server Error in '/POD/POMLNT' Application.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
 
What is it means , and how can i fix it ?

View 1 Replies

How To Create A Common Web.config File And A Bunch Of Specific Web.config Files

Feb 16, 2011

Currently, I work on an ASP.NET project which is hosted under version control and is used on several developer machines, tester machine and production environment.

In three cases, configuration (Web.config) may be different. For example, developer and tester environments use testing SQL Server, whereas in production environment, another SQL Server is accessed, so the connection string is different in those cases.

We want to keep three versions of Web.config in subversion. But modifying each of three files every time we need to add, remove or change a common setting is annoying: it would be nice to have a common, master Web.config, which will be inherited by each of the three Web.config files.

How to set up an ASP.NET project which will use a master configuration file and different slave configuration files on different machines, thus sharing the same project/source code/configuration files in subversion?

View 2 Replies

How To Determine Which Parent Config File Is Locking A Web.config Setting

Mar 15, 2011

When I open my ASP.NET site in IIS and try to open the .NET Trust Levels, I get an error message:

.NET Trust Levels There was an error while performing this operation.

Details:
Filename: ?C:inetpubwwwrootmyappweb.config
Line number: 445

Error: This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"),or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".

I've checked a few places, but I haven't found anything that seems like it would be locking that setting. Is there a systematic way of determining where that setting is locked?

I'm using IIS 7.5 and .NET 3.5 sp1.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved