Deploy application to AWS - asp.net

I am trying to deploy my application to AWS, when I delete Migration folder, and type Enable-Migration and change AutomaticMigrationEnable = true;
After that I go to Publish to AWS, after couple of minutes I got error
Login failed for user 'DESKTOP-0L8HK6U\denni'.
Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.
Failed to connect to server DESKTOP-0L8HK6U\SQLEXPRESS.
Cannot open database "MojaBaza" requested by the login. The login failed.
Login failed for user 'DESKTOP-0L8HK6U\denni'.
Connection String for Amazon
<connectionStrings>
<add name="Jericho" connectionString="Data Source=demodb.c5sevdrlkzev.us-west-2.rds.amazonaws.com,1433;User ID=user;Initial Catalog=user;Password=user123;MultipleActiveResultSets=true"/>
</connectionStrings>
Database connection
<connectionStrings>
<add name="Jericho" connectionString="Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Jericho.mdf; Integrated Security=True;MultipleActiveResultSets=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
I don't know why is looking for database called MojaBaza.
Where I made mistake guys ? Any help ?

Check with security group of your rds where CIDR /IP - Inbound Rule may be changed make it 0.0.0.0/0 this solved my issue hope it is useful

Related

Connectionstring doesn't work for Azure

I've been looking for this and haven't found a decent answer.
It's about my connectionstring in my web.config of my ASP.NET MVC application
This is my connectionstring:
<add name="DefaultConnection" connectionString="Server=tcp:****.database.windows.net,1433;Initial Catalog=***;Persist Security Info=False;User ID=****;Password=******;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />
I also have a second, which works perfectly:
<add name="treinsqlEntities" connectionString="metadata=res://*/TreinDB.csdl|res://*/TreinDB.ssdl|res://*/TreinDB.msl;provider=System.Data.SqlClient;provider connection string="data source=*****.database.windows.net,1433;initial catalog=*****;user id=*****;password=******;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
It works perfectly on localhost, but it doesn't online, (The database and site is hosted on Azure) so the pasword and username are definitly correct.
I use this connectionstring to log in/register, sign up, ...
What's the problem?
Huge thank you in advance to all you lifesavers!
Edit: This is the exception:
enter image description here
These are my firewall settings: enter image description here
That is likely because you have not opened the firewall up to all azure connections. By default there are no firewall rules added to your new databases/server in Azure. You have probably added your local client IP but not checked the box that is for all Azure connections. https://learn.microsoft.com/en-us/azure/sql-database/sql-database-firewall-configure#overview The section 'Connecting from Azure' should point you to the right setting.
Please be aware that this allows all IP's originating from Azure a connection into you DB. It does not allow access since your authentication mechanism will stop that but connections will be allowed from any subscription in Azure with this option checked.

Unable to complete operation. The supplied SqlConnection does not specify an initial catalog or AttachDBFileName

I am trying to create an App Service web app in the Azure Portal and to connect the web app to my local on-premises SQL Server database using the new Hybrid Connection feature.
Created a simple ASP.NET application using Visual Studio 2015 and trying to connect to the SQL server Database which is on on-prem. And modified the connection String as follows
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=PRAVEEN,1433; User ID=sa; Password=my_password;"
providerName="System.Data.SqlClient" />
</connectionStrings>
When the application is started its running without any errors as shown in below screenshot1.
But when I try register (enter any record) it throws me with an error as specified in the below Screenshot3....
"https://azure.microsoft.com/en-us/documentation/articles/web-sites-hybrid-connection-connect-on-premises-sql-server/" - this is the documentation to which I'm referring to..
So, can anyone from the other end help me out please...
Microsoft SQL Server Management Studio screenshot....
Thank you..
#Praveen,
It is what it says - meaning Initial Catalog is missing in your connection string. It requires the Db name to connect to. You have the servername, SQLUserName, SQLPassword, but missing the DatabaseName it requires. Please change your connection string to include the the DbName as follows
<connectionStrings>
<add name="DefaultConnection"
connectionString="Data Source=YourServerName,1433;Database="YourDbName" UserID=YourId;Password=YourPswd;"
providerName="System.Data.SqlClient" />
</connectionStrings>
Look at this site to configure your connection string appropriately: http://www.connectionstrings.com/store-connection-string-in-webconfig/

Database connection not working in ASP MVC

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" />
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="data source=192.168.1.2\SQLEXPRESS;initial catalog=DEMODB;user id=abc;password=abc;multipleactiveresultsets=True;application name=EntityFramework"" 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.
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;

how can i connect to database from IIS 5.1

When I want to connect to my site database via the local network، This message will appear:
Cannot log in to my_server_name/AspNet
My connection string is:
<connectionStrings>
<add name="behbahan_cementConnectionString" connectionString="Data Source=MAYA-1307F9F334\SQLEXPRESS;Initial Catalog=behbahan_cement;Integrated Security=True" providerName="System.Data.SqlClient"/>
</connectionStrings>`
I can't connect to the database?
I'd suggest you first try and establish whether you can connect to the database from outside the web application either via SQL Server Management Studio or by using a .UDL file. I've answered a question on testing a SQL server connection here.
Based on the results of these tests it may become apparent to you what the problem may be. In your case, you are using integrated security (which you would need to be on a domain to use over the network). If you are not on a domain, a username and password may need to be supplied.
Standard way to connect Database as;
<connectionStrings>
<add
name="NorthwindConnectionString"
connectionString="Data Source=serverName;Initial
Catalog=Northwind;Persist Security Info=True;User
ID=userName;Password=password"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
What I can See here is you are messing ;
ID=userName;Password=password"
to connect the database in connectionString. Default username and password should be "root" unless you have changed it.
Try to connect with this detail.
Thanks,

SQL Server Express 2008 Connection Error (26)

So I have few ASP.NET apps all running off SQL Server Express 2008 and working fine and dandy. I just put up a new one to test something and am now getting the Error 26 - can't find instance. What's weird is that the app is talking to the DB partially because it brings up the user login page and if I enter wrong data it returns a message about that (which is good). When I enter the correct login info it takes it then thinks for a few seconds and then throws the Error 26.
Here is my connection string --
<connectionStrings>
<add name="db_BPEntities" connectionString="metadata=res://*/App_Code.Data.db_BP.csdl|res://*/App_Code.Data.db_BP.ssdl|res://*/App_Code.Data.db_BP.msl;provider=System.Data.SqlClient;provider connection string="data source=LOCALHOST\SQLEXPRESS;initial catalog=db_BC_Build;user id=USER;password=PASSWORD;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="Default" connectionString="server=LOCALHOST\SQLEXPRESS;database=db_BC_Build;USER ID=USER;password=PASSWORD;Min Pool Size=10;Max Pool Size=800;Network Library=dbmssocn" providerName="System.Data.SqlClient" />
</connectionStrings>
Note: I've changed user/password info. The DB is running locally off the same box with IIS (it's a test intranet site so I'm ok with that for now).
So summary:
Other apps running off same DB have zero connectivity issues. They all connect and work fine.
This app partially works but on login throws the Error 26 - Instance not found.
Would it be that there are 2 connection strings here vs 1 connection string on my other DBs?
Really stumped.
Thanks for any/all help :)
Edit: I think the issue is with the Entity Framework and SQL Server Express. It seems to connect initially to authenticate the user, but then the EF connectivity to display data, etc is where it breaks. That's where I'm at right now and stuck in trying to figure this out (I didn't develop this application).
Try to connect without "Network Library=dbmssocn" in your connectionstring. I have had the same (error 26) issue and it did work for me.
I change app config file to this
<connectionStrings>
<!-- TLPL_ICT_OPR\MSSQLSERVER1;Initial Catalog=FMS;User ID=fms -->
<add name="DBConnectionString" connectionString="user id=fms;data source=TLPL_ICT_OPR\MSSQLSER;persist security info=True;initial catalog=username;password=password" providerName="System.Data.SqlClient"/>
<!--<add name="DBConnectionString" connectionString="user id=fms;data source=TLPL_ICT_PHOLIB\SQLEXPRESS;persist security info=True;initial catalog=FMS;password=fms4321"
providerName="System.Data.SqlClient" />-->
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
after this it works fine....
To quote from SQL Network Interfaces, error: 26, these are the steps to overcome this issue:
Make sure your server name is correct, e.g., no typo on the name.
Make sure your instance name is correct and there is actually
such an instance on your target machine. [Update: Some application
converts \\ to \. If you are not sure about your application, please
try both Server\Instance and Server\\Instance in your connection
string]
Make sure the server machine is reachable, e.g, DNS can be
resolve correctly, you are able to ping the server (not always
true).
Make sure SQL Browser service is running on the server.
If firewall is enabled on the server, you need to put
sqlbrowser.exe and/or UDP port 1434 into exception.
Please visit the link for more detail.

Resources