c# - Exception when trying to connect to SQL Azure Database -
i new windows azure.
i have local db .net application. have created azure account along relevant sql azure database.
i working on adding c# code in order pass data local application cloud. in order test functionality have added random user want insert azure db.
i have used following tutorial: http://www.windowsazure.com/en-us/develop/net/how-to-guides/sql-database/
i trying connect azure sql database using connection string in app.config:
<?xml version="1.0" encoding="utf-8"?> <configuration> <connectionstrings> <add name="starentities" connectionstring ="server=tcp:fkr95b1any.database.windows.net,1433;database=starsoftwaredb;user id=starsoft1@fkr95b1any;password=xxxxxx;trusted_connection=false;encrypt=true;" /> </connectionstrings> </configuration>
this method being used registration, code establishes connection azure database, failing on 'conn.open();'.
sqlconnectionstringbuilder csbuilder; csbuilder = new sqlconnectionstringbuilder(configurationmanager.connectionstrings["starentities"].connectionstring); sqlconnection conn = new sqlconnection(csbuilder.tostring()); conn.open();
on clicking register button triggers code, program hangs long period before throwing following error:
a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: tcp provider, error: 0 - connection attempt failed because connected party did not respond after period of time or established connection failed because connected host has failed respond.)
any or advice here appreciated.
update
i have changed connection string 1 @leonardo suggested below. have enable 'tcp/ip' , 'named pipes' in sql server configuration manager aswell allowing opening port 1433.
the dashboard master db showing successful connections on table still getting exception on
conn.open()
try here:
"server=fkr95b1any.database.windows.net;database=starsoftwaredb;user id=starsoft1@fkr95b1any;password=xxxxxx;"
and check firewall settings instance! might closed applications (default setting)