-1

I just create a new ASP MVC sample. The code was generate with scaffolding. Then I run the application and it runs smooth. But when I click "Register" link in top nav bar and tries to register it does not work.

My Connection String:

<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-ProductExa‌​mple-20151218101004.mdf;Initial Catalog=aspnet-ProductExample-20151218101004;Integrated Security=True" providerName="System.Data.SqlClient" />

enter image description here

enter image description here

Arijit Mukherjee
  • 3,817
  • 2
  • 31
  • 51
Emmad Zahid
  • 438
  • 6
  • 15

2 Answers2

0

It is saying that your connection with sql server is not established.

Please check your connection string.

Here i am showing mine. Please check it once. It may help you.

<connectionStrings>
    <add name="DemoEntities" connectionString="metadata=res://*/Models.Report.DemoEntities.csdl|res://*/Models.Report.DemoEntities.ssdl|res://*/Models.Report.DemoEntities.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=192.168.1.2\SQLEXPRESS;initial catalog=DEMODB;user id=abc;password=abc;multipleactiveresultsets=True;application name=EntityFramework&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

Check all following parameters are correct or not.

data source=192.168.1.2\SQLEXPRESS;

initial catalog=DEMODB;

user id=abc;

password=abc;

According to your sql server configuration you need to correct your connection string.

I needed to write IP\InstaceName may be in your you only need to write IP or only instace name. Please check it once.

Nirav Kamani
  • 3,192
  • 7
  • 39
  • 68
  • I changed my string to and its working now.Can some one explain me why its working? – Emmad Zahid Dec 18 '15 at 05:54
  • See here you corrected your sql instance name and DB path. you can check following link to know about |DataDirectory|. http://stackoverflow.com/questions/1409358/ado-net-datadirectory-where-is-this-documented – Nirav Kamani Dec 18 '15 at 08:05
-1

check sql server express is install or not on your machine if not then use local sql server that is install on your machine and change connection string data source=.; initial catalog=DEMODB; user id=abc; password=123;