开发者

Cannot connect to SQL Azure master from worker role

We're currently developing against SQL Azure and have (unsuccessfully) tried to point a worker role to the master database in SQL Azure in order to automate database operations which require the master.

Unfortunately this doesn't seem to work.

A bit of background: "Allow other Windows Azure services to access this server" is enabled, and we have a firewall rule set up to enable this.

We suspect it may be a missing firewall rule that hol开发者_开发百科ds the key to this. Our worker role works against other SQL azure dbs, just not against the master at present...

If anyone can point me in the right direction I'd be grateful!

Cheers, Iago


The issue with the master database turned out to be a red herring. The real issue was that I was using System.Data.SqlClient and Microsoft.SqlServer.Management objects to run a SQL batch script against the master (code in the style below).

var serverConnection = new ServerConnection(sqlConnection);
var server = new Server(serverConnection);
server.ConnectionContext.ExecuteNonQuery(sql);

After much banging our heads against a wall, the issue turned out to be that the required dlls to use these libraries just did not work in Azure (we kept getting errors about missing dependencies).

In the end, our solution to this was to break up the batch script into a number of subscripts (essentially splitting into parts wherever a GO statement was) and running using standard ADO.NET objects. This has turned out to be a better, more versatile solution so it has worked out OK for us after all!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜