All Questions
Tagged with connection-string asp.net-mvc
243
questions
94
votes
9
answers
176k
views
keyword not supported data source
I have an ASP.NET MVC application with the default membership database. I am accessing it by ADO.NET Entity Framework.
Now I want to move it to IIS, but several problems showed up. I had to install ...
26
votes
7
answers
147k
views
Connection string - Keyword not supported: 'initial catalog'
I am using Webmatrix.data's Database entity to create a database connection, however it doesnt like my connection string. I am running it from MVC ASP.net.
Ive tried changing it to server / database,...
26
votes
1
answer
48k
views
How do you put environmental variables in web.config?
I am currently Following these tutorials, and I am wanting to call the clear text string from Azure's Application Settings for Web Apps. I am under the impression that environmental variables are used ...
21
votes
1
answer
35k
views
The entry has already been added
All my Razors views have this error:
The pre-application start initialization method Start on type WebMatrix.WebData.PreApplicationStartCode threw an exception with the following error message:
The ...
13
votes
2
answers
2k
views
Where does this permanent SQLExpress connectionstring come from (not web.config)?
Today I noticed that in my ConfigurationManager.ConnectionStrings the very first instance is .\SQLEXPRESS. I remembered explicitly removing this entry from my web.config so I checked again, but didn't ...
13
votes
2
answers
32k
views
Where to look for UserId and Password for Azure SQL Server Connection
I have ASP.NET MVC app and I am trying to connect to Azure SQL database migrated on Azure.
I need to set my connection string in web.config and I have no idea where to look for the user id and ...
12
votes
5
answers
16k
views
Overriding code-generated DbContext constructor
I'm sure I've done this before at some stage, but I can't figure out how to now! My scenario:
// This is generated from EDMX
public partial class HOLDbEntities : DbContext
{
public HOLDbEntities()...
11
votes
9
answers
33k
views
asp.net mvc Invalid value for key 'attachdbfilename'
I am currently reading Manning's "ASP.NET MVC 4 in Action" book and trying to get the first example to work.
Within my test application, I built a simple Model and created some Views. I then ...
10
votes
4
answers
15k
views
How can I set read-only DB Connection Strings?
I've got a DB connection string that I'm creating in my web.config:
<connectionStrings>
<add name="DBConn" connectionString="Data Source=<db svr>;Initial Catalog=<...
10
votes
3
answers
3k
views
Can't connect to SQL Azure from app, but can from SSMS
I have a SQL Azure instance set up and can connect to it with no issue from SQL Server Management Studio. However when my app tries to connect, this error occurs:
A network-related or instance-...
8
votes
3
answers
3k
views
Changing ELMAH database in code
I have several websites that have separate ELMAH databases. I would like to have one separate website to view all these databases.
I've created a new ASP.NET MVC 4 website for this purpose. I've ...
8
votes
3
answers
4k
views
|DataDirectory| returns wrong path to AppData folder
|DataDirectory|, you had one job. |DataDirectory| on IIS7.5 resolves to:
C:\inetpub\wwwroot\appname\App_Data
That folder does not exist. The correct folder is:
C:\inetpub\wwwroot\appname\bin\...
8
votes
2
answers
10k
views
A network-releated or instance-specific error occurred while establishing a connection to SQL Server
I have a simple mvc web site (using the VS internet template) on azurewebsites talking to a SQL Azure database in the same data center. The database at this time is just to do the built-in ...
8
votes
1
answer
1k
views
How to Change ConnectionStrings at Runtime for a Web API
I hope this is a simple question:
How can you change 2 connection strings at runtime in the
Global.asax under Application_Start()
Web.config
<connectionStrings>
<add connectionString=...
7
votes
5
answers
10k
views
Where to place connection string in web.config
My web.config looks like this :
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=...
7
votes
4
answers
7k
views
Connection string in unit test project to reference database in app_data folder
I am looking to reference my database file in my unit test project. This is an ASP.NET MVC app.
Please note: I know I should not be accessing the database in my unit tests but this is for a quick fix ...
6
votes
2
answers
13k
views
Determine correct connectionString for web publishing for ASP.NET-MVC application
During development of ASP.NET-MVC application on local machine I used this connectionStringwith no problems whatsoever:
<connectionStrings>
<add name="DefaultConnection" connectionString=...
6
votes
1
answer
2k
views
ELMAH and SQL Server 2008 R2?
I try to run ELMAH with my ASP.NET MVC 2 project but have some problem to get it to work with my SQL Server 2008 R2 database.
This is what I have done.
Run the dbscript in my database, accidentally ...
6
votes
9
answers
3k
views
Two .NET projects, one DB connection string?
I have a .NET solution containing two projects:
An ASP.NET MVC project, 'Website'
A class library, 'Models'
The 'Models' project contains a Linq-to-SQL data-context along with a few partial classes ...
6
votes
3
answers
2k
views
ASP.NET MVC 5 Azure Website fails to connect to SQL Azure DB on some views due to role based [Authorize] attribute
We have an ASP.NET MVC 5 website, which works fine when we run it locally with Visual Studio. When run locally the website is connected to two SQL Express databases (the AspNetUsers & our Content ...
5
votes
2
answers
6k
views
Why am I getting "The magic number in GZip header is not correct." error using OWIN auth against Azure SQL
Nothing on Google or SO relates to this specific problem, so asking a new question. I created a brand new Asp.Net MVC Web Application with the standard user-security option. I also created an empty ...
5
votes
2
answers
11k
views
ArgumentException: Keyword not supported: 'server'
I have an Asp.net MVC5 application and have published it to Microsoft Azure. I first migrated my .mdf files toSql Azure Databases. The database connection string provided in the Azure Portal is not ...
5
votes
1
answer
3k
views
Limit Connections to Database with Entity Framework C#
I have an Azure database that is limited to 60 concurrent connections. My issue is that I have several crawlers that populate this database to be consumed by our website using Entity Framework.
It ...
5
votes
2
answers
7k
views
How to get connection string in class library project
In my .net solution, I have two different projects: An MVC core web application project and a class library project. In web application project, database connection string is in appsettings.json file. ...
5
votes
2
answers
25k
views
Reasons for "The network path was not found" in ASP.NET MVC
I made ASP.NET MVC web application, uploaded the files, also the database, but I get the following error when browsing it.
The network path was not found
I'm using Entity Framework and this is the ...
5
votes
1
answer
4k
views
Entity Framework: Illegal characters in path. (Connection String) (MVC3)
I just can't get this thing solved:
I'm trying to use the Entity Framework in my MVC3 project.
But each time I call Entities context = new Entities();
I receive this error: Illegal characters in ...
4
votes
2
answers
4k
views
When I publish, the content of connectionStrings in Web.Release.config is not copied
I have a connectionString in Web.Debug.config, and another one, different, in Web.Release.config.
When I publish my project, the content of Web.Release.config does not appear in the Web.config ...
4
votes
2
answers
5k
views
Merge aspnetdb.mdf with my own database (automatically generated)
I've searched the internet thoroughly but couldn't find a clear answer to the problem. I have got the aspnet.db database. But i want to add my own tables and data to this database. If i try to connect ...
4
votes
2
answers
7k
views
How to update Entity Framework Connection String
I have modified the web.config connection string. However, during debug, I still see the old connection string.
So, I have commented (and deleted) out the old connection string but, and added a new ...
4
votes
1
answer
2k
views
Injecting connection strings vs IDbConnection
What are the trade-offs for injecting connection strings vs. an instance of IDbConnection?
I use StructureMap to inject various services into my ASP.NET MVC application, most of which require ...
4
votes
1
answer
3k
views
why connection string is not found from my class library to another class library?
I am having the architecture like this :
Where MVC layer is the presentation layer. EF is class library and Repository is another class library.I am trying to insert data to database from ...
4
votes
2
answers
5k
views
CREATE DATABASE permission denied in database 'master'. error in MVC 4 application
After deploying my MVC 4 application, I try to register user, get such error:
CREATE DATABASE permission denied in database 'master'.
Connection string is :
<add name="Market" providerName="...
3
votes
1
answer
8k
views
Enabling Multiple Active Result Sets(MARS) in Entity Framework by connection string
I try to enable MARS(Multiple Active Result Sets) in ASP .NET MVC 5 web applications which uses Entity Framework.
I tried to add MultipleActiveResultSets=True to my connection string:
<...
3
votes
2
answers
14k
views
How to read ConnectionString from web.config in Asp.net MVC3 web Application?
I am working in Asp.net Razor MVC3. I have created a App_Code folder and make a class in which I want read connection string from web.config and working with database by using this class. I am writing ...
3
votes
6
answers
20k
views
IIS 7 can't connect to SQLServer 2008
Sorry if this is the most seen question on the web, but this is my turn. I am trying to publish my asp.net mvc app on IIS 7 under MS Sql Server 2008. I am on a Windows Server 2008 virtual machine. I ...
3
votes
3
answers
10k
views
"The ConnectionString property is invalid." when I know it is valid
I have an ASP.NET MVC application where the database is on an IBM i-Series server. I have the application development close to completion when I started to get a The ConnectionString property is ...
3
votes
2
answers
6k
views
SecurityException thrown on deployment
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 ...
3
votes
3
answers
5k
views
How to configure SQL Server to work with ASP.NET MVC with windows authentication?
This is my connection string:
<add name="MyDb" providerName="System.Data.SqlClient" connectionString="Server=localhost;Data Source=.\MSSQLSERVER;Initial Catalog=MyDb;Integrated security=SSPI;" /&...
3
votes
2
answers
3k
views
Using Entity Framework with two seperate database (Development and Production)
So I have been working on a project using Entity Framework 5 in development for a while and it is decided that the code will need to be moved to a production environment.
My question is what would be ...
3
votes
2
answers
7k
views
External Control of System or Configuration Setting
(Sorry, if this is a dumb question....)
Veracode reports my website has a security issue which relates to use connection string from web.config.
Here is my code.
Public Function ExecuteScalar(...
3
votes
2
answers
4k
views
Learning MVC3, connection string
I'm learning MVC3 by covering the famous MusicStore tutorial http://mvcmusicstore.codeplex.com/
The connection string used for EF code first is :
<connectionStrings>
<add name="...
3
votes
3
answers
6k
views
MVC 3 ASPNETDB.MDF SqlExpress Database Connection String on Web Hosting
I think this is more of a connection string issue that MVC 3, so sorry in advance.
I've created a website in MVC 3 with the default database that is created when you register a new user. It works ...
3
votes
2
answers
7k
views
How to make sql membership provider and entity framework work using my database?
I have .NET MVC 3 project where I use sql membership provider and entity framework.
I've created new database on my SQL server and created all objects for membership provider using aspnet_regsql.exe, ...
3
votes
1
answer
90
views
Creating a Controller for DevOps in .Net Core
I have a database schema known as BigDataOverview. Most of my Application is already connected to a different schema known as AdminDb.
I also have a .Net Core Application that is well integrated with ...
3
votes
1
answer
7k
views
Error when opening an sql connection: 'MyConnection.ServerVersion' threw an exception of type 'System.InvalidOperationException'
I have seen this problem in many posts, but cannot fix.. I'm trying to connect to a table in my SQL DB, using visual Studio 2015 (C#), and keep on getting an error.
This is my code (note: the ...
3
votes
1
answer
13k
views
Connect to a database from Web.Config <appSettings> section C# / MVC
I'm currently connected to a database using
Web.Config
<connectionStrings>
<add name="MVCDatabase" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\...
3
votes
1
answer
2k
views
I can't set up a connection string for ASP.Net MVC v4.0 with standard method of Authentication
Please I need help with this scenario:
I want to use the default ASP Membership/Authentication in my MVC app, connected to a VPN.
In web.config I setup the connection "MyCustomConnection":
<...
3
votes
2
answers
8k
views
Creating Database Model on ASP.NET MVC with MYSQL
I'm using ASP.NET C# with database MYSQL, I follow this step on creating a database model with Entity Data Model Wizard http://www.asp.net/mvc/tutorials/movie-database/create-a-movie-database-...
3
votes
1
answer
450
views
How to set dynamic connection string username and password on ASP.Net MVC when connecting to AS400
I am rewriting an old visual basic 6 application by using ASP.Net MVC.
This old app will extract data based on username and password the user entered. It uses the username and password to connect to ...
3
votes
1
answer
1k
views
Dynamic database connectionstring based on Identity Claims
I'm adding some 'tenancy' to my web application.
My web application uses 2 databases
Identity database
One tenant specific database (all same schema)
The application was built using one static ...