简体   繁体   中英

deploying website doesn't work the database access

I have a website that access a sql database in localhost and it works, but when published in an Azure website, can't reach the database. I've changed the connection string with visual studio on line pointing to a new database created in Azure, but can't reach the database.

There is a way to track the error? because the application only returns to the same webpage (this is the caondition when the connection to the database fails.

Any suggestion?

Check that the Azure firewall has a rule for the IP address of the machine hosting the website. You can do that by either of two methods:

  1. Navigating to your Azure Portal using a browser that is on the same machine that is trying to access your database.
  2. Go to the 'SQL Databases' section and click on the database.
  3. In the 'Design your SQL database' section, click on 'Set up Windows Azure firewall rules for this IP address'.

If the machine already has a rule the portal will indicate that. Otherwise a new rule will be added.

The other way:

  1. From the Management Portal, click SQL Databases. All databases and their corresponding servers are listed here.
  2. Click Servers at the top of the page.
  3. Click the arrow beside the server for which you want to manage firewall rules.
  4. Click Configure at the top of the page.
    • To add the current computer, click Add to the Allowed IP Addresses.
    • To add additional IP addresses, type in the Rule Name, Start IP Address, and End IP Address.
    • To modify an existing rule, click any of the fields in the rule and modify.
  5. Click Save at the bottom of the page to save the changes.

How to: Configure Firewall Settings (Azure SQL Database)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM