I have a dev system connecting to an Azure database. Works fine. When I deploy the system to an Azure WebApp, I get sql connection error "The server was not found or was not accessible."
Some more information:
In App Services > GreenStore > Settings > Application Settings I have filled in the connection strings as follows:
DefaultConnection Server=tcp:gserver.database.windows.net,1433;
Data Source=gserver.database.windows.net;
Initial Catalog=GDB;Persist Security Info=False;
User ID=xxx#xxxxserver;Password=xxxxxxx;Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=10
SQL Server
StoreDBEntities
metadata=res://*/Models.StoreModels.csdl|res://*/Models.StoreModels.ssdl|res://*/Models.StoreModels.msl;
Server=tcp:gserver.database.windows.net,1433;
Data Source="gserver.database.windows.net;
Initial Catalog=GDB;Persist Security Info=False;
User ID=xxx#xxxxserver;Password=xxxxxxx;Pooling=False;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=10;"
Custom
Is there a mistake in the connection strings which I entered in App Services > GreenStore > Settings > Application Settings or is another issue. I can connect from my dev machine using the above connections strings in web.config versions.
Related
I have WebJobs running under my Azure Web App. For Web App you can set that the Web App will use remote connection strings (that you setup on Azure portal).
Is it possible to do the same for WebJobs?
So they would be looking for remote connection string instead of using a connections string from (for example) "app.config".
Could you add the connection string as Web Config value that can be accessed by either the site or webjob?
Further more details you could refer to this blog:Configuring Azure Web Jobs.
The main steps are as follows:
Install CloudConfigurationManager package Microsoft.WindowsAzure.ConfigurationManager
Set your connection strings to the app setting.
Retrieve connection string using the CloudConfigurationManager:
var myConnectionString = CloudConfigurationManager.GetSetting("MyConnectionString");
I found out that a connection string setup on Azure Portal overwrites connection string with the same name in .config files. Which means that no additional setup is required.
Azure Portal Connection string takes priority over local *.config connection string.
I successfully tested this.
I have issue with word Automation service. Permissions on DB which is hosted on SQL server are ok. There are no timeouts and errors on DB, verbose shows only this kind of log:
Database 'WordAutomation_01_SADB01':
Connecting with connection string 'Data Source=XXXXXX;
Initial Catalog=WordAutomation_01_SADB01;
Integrated Security=True;
Enlist=False;
Connect Timeout=15'
App 'Word Automation Service 01': GetJobStatus complete: 00000000-0000-10a8-8031-1ce281d9f091; time = 518.00 ms
Proxy 'Word Automation Service 01 Proxy': GetJobStatus 00000000-0000-10a8-8031-1ce281d9f091 complete; time=15.00 ms
I have got 2 env~ PROD and PREPROD. It works on PROD but unfortunately not on preprod.
Any ideas where I should search issues?
I'm following a tutorial for setting up easy tables in Azure but I'm getting 'There was an error while initializing App Service app for 'blahblahapp'. 'Error connecting to SQL server (SQL error code 40532)'.
My connection string is:
Data Source=tcp:blahblahapp.database.windows.net,1433;Initial Catalog=blahblahapp_db;User ID=myemail#email.com;Password=blahblahpassword.
I've had a similar problem before while following another tutorial where my sql connection credentials were copied from the connection string given by Azure and pasted into a visualstudio c# program but it came up with errors and would not connect using the username myemail#email.com instead of the username given which was the same myemail#email.com I had to put myemail#email.com#database.azurewebsites.net so I'm thinking this could be the problem.
Or is it????
This problem is happening in the Azure console but how do I edit the connection string given by azure so that it is myemail#email.com#database.azurewebsites.net?
So I have this connection string:
Server=tcp:{dbserver-name}.database.windows.net,1433;Database={db-name};User ID={db-admin-name}#{db-server};Password={admin-pass};Trusted_Connection=False;Encrypt=True;Connection Timeout=30;MultipleActiveResultSets=True
And in the azure database server settings, I have granted my current client id to access it, as well as having ticked the 'Allow access to Azure services' box.
So, when I debug locally, I can connect and all's good.
But when I publish to azure and try to run it from there, I get:
Login failed for user '{db-admin-name}'.
I am trying to get the IIS logs to the database. Followed the steps as given in this website http://blog.datacenterfromhell.net/2013/08/how-to-write-iis-logs-to-database-using.html
It doesn't seem to work, got an error in Windows event log..
EventID: 1016
Error: The World Wide Web Publishing Service (WWW Service) did not configure logging for site 1. The data field contains the error number.
Environment:
OS - Windows 7
DB - SQL Server 2008 R2 Express edition
Please help if you have encountered same error previously.
Thanks, Naveen
Steps added:
Step 1: Create DB
Create an empty database on any Microsoft SQL server. Make sure that the identity that used for the Application Pool which is serving the Web Site has write access to this database.
Step 2: Create a table using logtemp.sql script
In C:\Windows\System32\inetsrv\ you will find a script called logtemp.sql, use it to create a table in the database you just created.
Step 3: Create System DSN on the web server that points to the
Create a System DSN on the web server that points to the DB created in step 1.
I would recommend to use the identity of the IIS Application Pool to configure the ODBC connection, since this account will later also write the log data to the database. Let's call our DSN IISLoggingDSN.
In this post I explained how to create a System DSN.
Step 4: List ODBCLogging settings
Open elevated cmd and change directory to C:\Windows\System32\inetsrv>
To get a list of all ODBCLogging settings configured so far, run this command.
C:\Windows\System32\inetsrv> appcmd list config -section:ODBCLogging
This should be empty.
Step 5: Set the ODBCLogging settings
To setup a ODBCLogging connection, issue the following command:
appcmd set config -section:ODBCLogging -datasource:IISLoggingDSN -tableName:InternetLog -username:DOMAIN\IISLogsUser -password:P#SSwoRD$
Let me explain the switches:
-section: SectionName we want to configure
-datasource: the name of the DSN we configured in step 3.
-tableName: name of the table in the database
-username: Active Directory domain account that has permissions to write to the database
-password: password of this user, it will be stored encrypted in the config file
Step 6: Enable ODBCLogging for one web site
To enable the logging for a web site, run this command.
C:\Windows\System32\inetsrv> appcmd set sites "Default Web Site" -logFile.logFormat:Custom -logFile.customLogPluginClsid:{FF16065B-DE82-11CF-BC0A-00AA006111E0}
IMPORTANT: The customLogPluginClsid attribute must be set to "{FF16065B-DE82-11CF-BC0A-00AA006111E0}"
This ID I took from the Microsoft documentation. It defines that the custom format is ODBCLogging.
Let me declutter these switches as well:
-sites: the site that will write to the logs, I tested with "Default Web Site"
-logFile.logFormat: by configuring Custom we configure that custom format will be used
-logFile.customLogPluginClsid:{FF16065B-DE82-11CF-BC0A-00AA006111E0}: see above
Naveen, did you meet all prerequisites?
The IIS Web Site which should write its log to a database must be served by an Application Pool that is using an AD Domain account identity to run.
The same AD Domain account must have RW access to the DB that will be target for the IIS logs.
ODBC AND Custom Logging must be installed on the IIS server
I wrote this blog post some months ago. You may also reach out to me via the comments of the blog.