简体   繁体   English

如何在web.config中将Oracle SID指定为connectionStrings?

[英]How to specify Oracle SID to connectionStrings in web.config?

I have an ASP.NET application whose connection to the database seems to fail to open because of the Oracle SID not being specified. 我有一个ASP.NET应用程序,由于未指定Oracle SID,与数据库的连接似乎无法打开。 I can't find any doc on how to specify it in the connection string. 我在连接字符串中找不到有关如何指定它的任何文档。 Did anyone have the same problem? 有人遇到过同样的问题吗?

Here is the sample : 这是示例:

         <connectionStrings>
            <add name="{ConnectionName}" 
            connectionString="Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=MyOracleSID)));User Id=myUsername;Password=myPassword;" 
            providerName="Oracle.DataAccess.Client"/>
         </connectionStrings>

After adding the connection string to the web config you can use 将连接字符串添加到Web配置后,您可以使用

System.Configuration.ConfigurationManager.ConnectionStrings["connectionStringName"].ConnectionString;

To retrieve the connection string 检索连接字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Web.config connectionStrings用于Oracle数据库 - Web.config connectionStrings for Oracle database 在web.config文件中加密connectionStrings - Encrypting connectionStrings in a web.config file 如何自动从Azure CICD管道对web.config和connectionStrings.config文件进行XML转换? - How to automate XML transformation for web.config & connectionStrings.config files from Azure CICD pipeline? 如何在web.config中指定根(/)位置? - How to specify root (/) location in web.config? 区分machine.config和web.config中的ConnectionString - Differentiate between ConnectionStrings in the machine.config and web.config 覆盖app.config(或web.config)中的ConnectionStrings - Override ConnectionStrings in app.config (or web.config) 不同Web应用程序的通用web.config连接字符串? - common web.config connectionstrings for different web applications? Web.config文件中的appSettings和connectionStrings之间的区别? - Difference between appSettings and connectionStrings in Web.config file? 更改Web.config connectionStrings而不重置会话 - Change Web.config connectionStrings without resetting sessions 我们可以在web.config中加密外部appSettings和connectionStrings吗? - Can we encrypt external appSettings and connectionStrings in web.config?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM