Unable to setup episerver default application (failed to attach the episerver database) - sql-server

I'm trying to integrate Episerver into my visual studio project. I've downloaded the Episerver CMS extension through NuGet manager and everything went well.. The issue here is that when I try to access the episerver CMS panel like this:
localhost:port/episerver/cms I get the following error
Directory lookup for the file EPiServerDB_ae17da15.mdf failed with the operating system error 5(Access is denied.).Cannot attach the file EPiServerDB_ae17da15.mdf as database 'EPiServerDB_ae17da15'.
And this is my connection string:
<connectionStrings>
<add name="EPiServerDB" connectionString="Data Source=.;AttachDbFilename=|DataDirectory|EPiServerDB_ae17da15.mdf;Initial Catalog=EPiServerDB_ae17da15;Connection Timeout=60;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
What am I doing wrong here? Can someone help me out?

Try
<connectionStrings>
<add name="EPiServerDB" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|EPiServerDB_ae17da15.mdf;" providerName="System.Data.SqlClient" />
</connectionStrings>
Using the MDF-database do require you to have SQL Server LocalDB installed, I believe it is available as an install option of Visual Studio as well.
== Edit ==
If you are missing the MDF-file simply create a new using Visual Studio, create a new item and select the SQL Server Database

As Erik mentioned you will need to have SQL Server LocalDB installed to attach the .mdf file if you go with that option. If you already have the "full" SQL-server installed you can create an empty database, add the relevant connectionString and run
Initialize-EPiDatabase
in the package manager console. Now you don't need to install LocalDB.

Related

MVC4 Is my Connection String to SQL Server 2014 correct

I'm using Visual Studio 2012 for Web and I'm coding a MVC application. By default it uses a localDB but I want it on a SQL Server. I've installed SQL Server 2014 and my servername is C0208\SQLEXPRESS.
C0208 is my computer name
Named Instance: SQLEXPRESS
InstanceID: SQLEXPRESS
This is my connectionstring to the localdb
<add name="IssueContext" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=RecreationalServicesTicketingSystem;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\RecreationalServicesTicketingSystem.mdf" providerName="System.Data.SqlClient" />
I tried using this connection string and I don't know if it's correct or not
<add name="IssueContext" providerName="System.Data.SqlClient" connectionString="Data Source=C0208\SQLEXPRESS;User Id=C0208;Initial Catalog=DatabaseName;Integrated Security=True;MultipleActiveResultSets=True" />
This looks more of an Entity Framework issue rather than the SQL connection string. Just check if you have updated the connection string everywhere. (app.config).
To Enable data migration you will have to run the following command in the Package Manager Console.
enable-migrations
if it gives an error than try the following command first
add-migration projectName
For more details check this link

DNN 7 installation

I'm trying to configure a DotNetNuke 7 (DNN 7) but the following error occur
ERROR:Index #: 0
Source: .Net SqlClient Data Provider
Class: 20
Number: 2
Message:
the database is SQL server 2008 R2, both database and web server on localhost. I checked the username and all instruction in the following like carefully but nothing changed
the installation guide link
http://www.dnnsoftware.com/community/learn/video-library/view-video/video/515/view/details/dnn-7-0-installation-part-1-file-system-configuration
Check to verify that you SQL Server instance name is the Default instance, if it isn't, you'll need to change the name when connecting to it.
Something like "localhost" would work for the default instance, but if you named it something else, you would use "localhost/somethingelse"
You also should attempt to connect to your DB server using SQL Server Management Studio, with the exact same information you are trying to use in DNN.
This is an elder question, but hopefully somebody benefits from this answer.
My connection string in DNN's web.config looks like this:
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;AttachDbFilename=|DataDirectory|Database.mdf;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient" />
This is an SQL Server 2016 Express instance. The MDF file will be in the App_Data folder of the DNN installation.

Cannot create a local sql server 2012

I am trying to create a database for an MVC 4 application. I used Entity Framework Code first approach. After digging into the problem I realized that it was not a connection string issue. I downloaded Sql Server Data tools and tried to create it from there but I get the same exact error which is related to Windows Authentication. I am not sure what is causing this problem, I even tried running as admin.
Any ideas??
I have tried mostly all forms of connections strings available online, the last two that I tried were
<add name="Request" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=Requests;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Requests.mdf" providerName="System.Data.SqlClient" />
<!--<add name="RequestsContext" providerName="System.Data.SqlServerCe.4.0" connectionString="Data Source=|DataDirectory|\Requests.mdf" /> -->
I am trying to create a local database, I have asked a question about entity frame work right here thinking that the problem was from there but now I know it has nothing to do with it. Here you can see all of the details about the models I created and I am trying to generate the database from.
Using Entity framework with SQL Server 2012 (local *.mdf database)
You don't have SQL Server installed on your PC. Install Express Edition and you should be fine.
EDIT: Use connection string for local server:
<add name="Request" providerName="System.Data.SqlClient" connectionString="Server=.\SQLEXPRESS;Database=Request;Integrated Security=True;" />
If its local, probably SQL Server service is not running. Start>cmd and services.msc will open services page. Right click on sql server and start

Database Connection Error DNN 7

i am really frustrated from this problem, i am trying to install DNN 7 in windows server 2008, i follwoed the steps in DNN site for installation, but when i run installer wizard i am getting connection error, i give the user permission on Folder level, as owner to the database, and still nothing, do i need to modify the connection in web.config file? is this correct
note:
database name: dnndev.me
user name: Administrator
Password: password
<add name="SiteSqlServer" connectionString="Data Source=.\SQLExpress;Integrated
Security=True;User Instance=True;AttachDBFilename=|DataDirectory|dnndev.me.mdf;"
providerName="System.Data.SqlClient" />
please help
this is my second post and i am not getting answer
How's your SqlServer set up? If the server is setup to use integrated security, you really don't need a username/password as Chris pointed out. In that case, the connection string in your web.config <ConnectionString> and <AppSettings> sections should look like
Data Source=.\SQLExpress;Integrated Security=True;User Instance=False;Database=dnndev.me;
Check out this blog for more details.
If you are using SQLExpress, and you have SQLExpress installed locally using the default instance, you don't need to worry about usernames/passwords for the database. DNN will attach the MDF file in the app_Data folder automatically.
If you are using another INSTANCE of SQL, than you will want to create the Database, and then associate a username/password that is DB_OWNER for that database, and provide that during the installation process. If that is the case, DO NOT choose the SQL Express option, use the SQL 2008 option.

How can I view the data in an SQLEXPRESS DB which is connected in Web.config?

I'm running Visual Web Developer 2010 Express. I have added an additional SQLExpress DB to the standard ASPNETDB.mdf. Both are connected through the web.config. Everything runs fine. The connection strings are as follows:
<add name="TrempimModel"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|TrempimModel.mdf;
database=TrempimModel;User Instance=true"
providerName="System.Data.SqlClient" />
<add name="ApplicationServices"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient" />
But how do I view the data in both DB files? To my surprise, although the files are refferenced in web.config, the DB Explorer in the IDE does not show them. If I go and add either or both in the DB explorer, strange stuff starts happening - mainly the application is not able to connect to my added DB at application launch.
So what is the best way to view SQL Express table data? Is it through the IDE, or a seperate application? And why isn't the DB explorer showing a connection established in web.config?
Thanks,
Gil
Problem Solved - surprisingly enough, by eliminating the connection sting altogether. That way, the database is created by the DB engine and attached automatically by Management Studio, so the data can be viewed over there, while debugging.
I wander why all the walk-through descriptions eliminate this option which is as hassle free as they come... One point to remember is that you need to exit the Management Studio before running the application with data model changes that will cause the DB to be re-created.

Resources