Last post Jan 29, 2017 11:15 AM by timzigg
Jan 28, 2017 12:30 PM|timzigg|LINK
I'm having an issue where the page I'm trying to create on Azure is simply showing the text: "The page cannot be displayed because an internal server error has occurred." I'm using the connection string provided by Azure with the only change
being to the username and password. If I delete the connectionStrings block the page loads fine.
Could somebody verify if I'm structuring the web.config file correctly? A Microsoft site I found regarding this showed everything inside the <connectionStrings> tags but didn't show where in the file they belong. I'm also not sure if the username and password
are to be encapsulated in quotes or not.
Cheers - It's my first time trying to do this.
<?xml version="1.0" encoding="utf-8"?>
<add name="PWDB"; connectionString="Server=tcp:prodwisedata.database.windows.net,1433;Initial Catalog=ProdWiseData;Persist Security Info=False;User ID='user';Password='password';MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"/>
<compilation debug="true" targetFramework="4.0" />
Jan 28, 2017 01:02 PM|HostingASPNet|LINK
You should check the connection string, as it seems that when try to connect you receive the error.
Jan 28, 2017 01:40 PM|PatriceSc|LINK
Remove the extra ; after the name attribute. If you have single quotes around the user name and password in your real connection string, remove them.
If the config file is correct but the connection string is not, you should have a server side exception that should give some details (for example if the connection string is correct but your user id/password is wrong). It's easier to see fist what is the
exact error you have rather than looking at your app and wondering which error it could cause.
Jan 28, 2017 05:57 PM|mohtshm|LINK
Though I've not deployed on azure, But there are couple of errors
1) you need colon : not ; to mention port
2) as you ask no need for '' if there are no space in them .
3) there is no provider "attribute" part mentioned in your connection string
<add name="nameofconnectionstring" connectionString="serverinfo" providerName="providernameforMSSQLorMYSQLorAny" />
Jan 29, 2017 11:15 AM|timzigg|LINK
Thanks for the answers!
I fixed those little syntax issues and the page is now operating as expected, I'm now moving onto the code where I'll actually use the database.
I didn't add a provider name, the connection string was provided by Azure so I'm assuming it's not needed for this - I'll keep it in mind if I run into more trouble though.