connection-string

Connection String Error (error : 40)

孤人 提交于 2019-12-02 20:48:11
问题 I have installed SQL Server 2012 Express on a Windows Server 2008 Machine. The name of the machine is "THEMACHINE". While installation, I set SQL Server 2012 as "Default Instance". Now I set my connection string like this : <add name="BooksContext" providerName="System.Data.SqlClient" connectionString="Data Source=THEMACHINE;Initial Catalog=newdb; User ID=sa; Password=123456"/> But I get this exception : {"A network-related or instance-specific error occurred while establishing a connection

How to get connection string out of Azure KeyVault?

南笙酒味 提交于 2019-12-02 19:17:23
A hypothetical web-site currently connects using: public SqlConnection CreateConnection() { DbConnection connection = new SqlConnection(); connection.ConnectionString = GetConnectionString(); connection.Open(); return connection; } Where the magical connection string is stored in web.config : String GetConnectionString() { //Get the connection string info from web.config ConnectionStringSettings cs = ConfigurationManager.ConnectionStrings["db"]; if (cs == null) throw new Exception("Could not locate DB connection string"); return cs.ConnectionString; } Now i'd like to move the connection string

Need Encrypted connection string and stmp information in the web.config

为君一笑 提交于 2019-12-02 19:03:14
问题 I want to keep encrypted connection string and stmp information in the web.config. can I store Connection String and SMTP information in web.config encrypted and where I need just decrypted and use? OR What is the point/event where i can encrypt the Connection String and SMTP and save in the web.config? (and if the changes happen in web.config in that, is existing session expired?) What is the best solution? Thanks 回答1: It's easy to do with aspnet_regiis.exe- look at the pe/pd/pef and pdf

The right connection string for Remote SQL server for C#

天涯浪子 提交于 2019-12-02 18:35:53
I just want to know the right sql connection string for a remote sql server express edition. This is what I got but I got some problems SqlConnection cs = new SqlConnection(@"Data Source=(IP Address)\PC-NAME\SQLEXPRESS,1433;Network Library=DBMSSOCN;Initial Catalog=dbase;User ID=sa;Password=password"); I got this error in my C# debugger: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

Multipleactiveresultsets in Entity Framework 4.1 Code First

为君一笑 提交于 2019-12-02 17:41:32
This is my first EF project so bear with me please. When updating an entity such as Department, you pull it from the context, update its values and call context.SaveChanges. However, if you update Department.Employees, EF does not find that funny. I searched and came up with the option of setting Multipleactiveresultsets=true in the connection string but want to know if: Is this the recommended way? Does this adversely affect performance / what should I look out for? Ladislav Mrnka Enabling MARS is only necessary if you want to execute multiple queries on the same connection in parallel. This

Managing A Debug and Release Connection String

若如初见. 提交于 2019-12-02 16:25:12
What is a good approach to managing a debug and release connection string in a .NET / SQLServer application? I have two SQL Servers, a production and a build/debug and I need a method of switching between the two when my ASP.NET application is deployed. Currently I simply store them in the web.config and comment one or the other out, however that is error prone when deploying. Create a Debug and Release version of the Web.config file, e.g. Web.debug.config and Web.release.config. Then add a pre-compile condition that copies the relevant version into the web.config based upon the current Target

Connection string hell in .NET / LINQ-SQL / ASP.NET

有些话、适合烂在心里 提交于 2019-12-02 15:36:16
I have a web application that comprises the following: A web project (with a web.config file containing a connection string - but no data access code in the web project) A data access project that uses LINQ-SQL classes to provide entities to the web project UI (this project has a settings file and an app.config - both of which have connection strings) When I build and deploy, there is no settings file or app.config in the Bin directory with the data access .dll, but changing the connection string in the web.config file doesn't change the database accordingly - so the connection string must be

SecurityException thrown on deployment

北慕城南 提交于 2019-12-02 13:21:59
问题 I have just written an MVC application and got it working in my lab. Now that I've deployed it to GoDaddy, I am getting the following error. Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: System.Security.SecurityException: Request failed. Source Error: An unhandled

How to set a table adapter's connection string (to one that is dynamically set)

ぐ巨炮叔叔 提交于 2019-12-02 13:06:25
问题 I just inherited the role of "Database Guy" from another developer who is no longer with the company, so please forgive me if I sound particularly noobish. The application is a VB.NET 4 application. The DB connection string for our table adapters was a string in my.settings (My.Settings.DBConnectionString) that is being set at runtime. When I had to modify the table adapters they couldn't see any data in My.Settings.DBConnectionString and thus did not allow me to edit them until I set a "real

appharbor connection string

喜夏-厌秋 提交于 2019-12-02 12:02:59
I'm building an ASP.NET MVC3 application that requires access to a database. I've successfully set up the database on my local machine and everything works fine but then I uploaded the app to appharbor.com for testing and now I can't access the database anymore. How do you add a connection string for a SQLEXPRESS database on appharbor.com? The database file is in located in the App_Data folder. I've been trying for days to make it work without avail. I already added the SQL Server add-on on appharbor. I'm not using any Entity Framework features if it helps to know. You shouldn't use