I am trying to upgrade my application from being in a local machine (both application and SQL server) to using the combination of Azure APP and Azure SQL service. I have successfully published the code in the Azure Web App, and the Application works except from one error that keeps on comming.
"{serviceResponse:{success:false,message:"System.InvalidOperationException: When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance."
in the Application start I am indeed using the SqlDependency that works only locally. The only sort of solution I found is to use the SqlNotificationRequest, but I have not been able to make it work using it.
What corrections do I need to do in order to make the App work with my remote DB? I am using C# (.net) and SQL server 2016.
Related
Is there a way to install pre requisites from an UWP app published in the store?
I want to develop several multi user UWP apps that use SQL Server.
First I was trying to get all SQL server instances within a network to be able to select one if present, or give the option to install a server if none exists. Seems that UWP cannot use any existing method to get those instances:
SqlDataSourceEnumerator is not present in net core
SqlClientFactory.CanCreateDataSourceEnumerator is always false
SmoApplication.EnumAvailableSqlServer also throws exceptions and cannot be used from UWP, as seems that it also uses SqlDataSourceEnumerator
Then I was trying to use Process from System.Diagnostics to start a cmd, use "net view" to get all workgroup computers, and then, by powershell or cmd, get services running on those computers to check if sql express exists. But, Process cannot be used from UWP apps, always throws access denied (even with "runas", that cannot be used as it needs Process.StartInfo.UseShellExecute, that trows a "platform" error). I was hoping to use cmd or powershell to download and install SQL Server too. When I was using winforms I installed it even from the setup (using innosetup)
So, as long as you can connect to almost any type of database server from UWP, how can we use the store to deliver apps that need any pre requisite?
I have a SQL Server with two databases, a production database and a development database. The .net 2.0 website hitting the production database with manual SqlConnection code is working fine. The other database is being hit from a newer ASP.NET MVC app using Entity Framework 6.2 and is getting timeout issues. The timeout takes 30 seconds the first time, but the page comes back almost instantaneously on subsequent refreshes. Both websites are on the same box as the database, so are only using "localhost" to connect. They are using SQL Server user logins, not Windows authentication.
I copied the .edmx and .tt files into a .net console app and that app has no problem hitting the database with the exact same linq query and pulling the same data that is failing.
I then created a new web site and copied just that same code into an aspx page. It fails the first time with a timeout, and then works on subsequent attempts (and a week ago, the main dev site was doing the same thing).
I separated the dev database from the SQL Server 2008 R2 server and attached it to a newly installed instance of SQL Server Express on a different port, and get the same results.
The web server is windows server 2008 standard 32-bit. I copied both websites and the console application to a new box (I thought was 2016, but it turns out it is 2008 standard 64-bit) and get the same results.
The dev site was working up until a couple of months ago. The client was using local user accounts for everything, but had a domain and wanted to do testing with windows authentication for an old vb app that hits the same database, and I had started migrating testing accounts to the domain. When the client tried to later, for an unrelated reason, change his password, we discovered that he was already using a domain account, but that his laptop could not connect to the domain. We found several other computers that could not connect, even though the machines I had connected to the domain during my testing were working fine. An outside network "friend" was brought in to figure out what was going on. At that point, I lost all track of what was actually done. I know that different network and domain configurations were tried and didn't fix the domain issues, but I don't know what. However, the production site was never rendered inoperative.
I have no idea what is going on. Does anyone else?
Oh, and in case it was a provider issue, I've also tried manual connection using OleDbconnection from the web app, and it also fails with the Timeout issue.
Update:
I spun up a new DataCenter 2016 box, installed IIS and .net on it and copied the website to that box. It has no problems hitting the database and pulling the data from the other server.
I know patches and such were updated on the original box while the domain and network were being manipulated, but I don't know how far behind they were. I suspect that some patch changed some default or inherited .net configuration options or something. I did do a "repair" on the .net installation, and that didn't make a difference. However, with the production site working fine, I'm not currently willing to uninstall .net or anything else. I'm afraid I would risk pushing this same error into the production site and the client would be screwed.
It seems that for some reason, the timeout period elapsed while attempting to consume the pre-login handshake acknowledgement.
Try increasing the connect timeout property in your connection string to 60 or more. Default is 15 (in seconds).
Example: Data Source=(LocalDB)\v11.0;Integrated Security=True;Connect Timeout=30
I am using a windows programming in c#,the windows service which I am using as to connect mysql database to fetch the data and it has to upload the data to server.But when the services is being started in my local system, the windows service is getting started first and then Mysql database service is getting started.
In this case, it is unable to connect to mysql database, so that I have to create a dependency that mysql should start first and then windows service has to start next.
How to implement the dependency code in my program,such that the clients who are using this windows service should not effect with this problem,I have do it through code that it has to be done automatically.
You can set DelayedAutoStart = true for you System.ServiceProcess.ServiceInstaller in your Installer class.
I have a windows service written in c#, which when running connects to a sql server database.
When the service first starts it connects to the database to obtain various information for the service to run.
The service is set to automatically start if the server it is installed on is restarted.
If the service starts before the sql server service has started. My service when started obviously has an initial execption error when trying to connect to the database.
To combat this issue, if the exception occurs I have added a short delay before try to connect to the database again, I continue this n amount of times until it connects
My question is, is there any alternative solutions to what I am doing already
thanks
Make your service dependent on SQL Server, done using ‘sc’.
Using a poll, as you're doing right now is fie, and you'll still need it if your service starts after SQL Server because you can never be sure SQL Server has fully started then.
I have read this page: http://www.mongodb.org/display/DOCS/Azure+Deployment, but it seems to be talking about actually setting up an Azure application, which I'm not interested in. I just want to host a Mongo DB on Azure which I can access from some non-Azure application using a connection string. I also tried running the script on this page: http://www.mongodb.org/display/DOCS/MongoDB+Installer+for+Windows+Azure but it threw an exception when it tried to validate the image name. Is what I want possible?
The reason for all of this is that I'm trying to compare MongoDB and Azure Table Storage, and I want to make the scenarios as similar as possible when I performance test.
The first link in your question talks about deploying MongoDB in Windows Azure (also accessible by other applications), but this in a traditional PaaS context. This means you'll be deploying MongoDB in a hosted service/cloud service.
If you want to host MongoDB on Windows Azure in a way that "feels more natural" you should consider deploying it in a Virtual Machine (the second link in your question). There's actually a how to on the Windows Azure website that will guide you through the whole process of creating a VM and deploying MongoDB on that VM: Install MongoDB on a virtual machine running Windows Server 2008 R2 in Windows Azure
Both ways to deploy MongoDB will allow you to access it from non-Azure applications, you'll simply need to configure the endpoints correctly (allowing access to specific ports from outside the datacenter).
Note that Virtual Machines (IaaS) is still a preview feature and the performance in the preview might not reflect the performance of the final version.
You can run MongoDB on Windows Azure two ways. First way is to run as Cloud Service which is described here however this is not what you want.
The second option to run MongoDB on Windows Azure to use Windows Azure Virtual Machine (either Linux or Windows) and then install MongoDB on it. The link below explains how you can install MongoDB on a CentOS machine in Windows Azure:
https://www.windowsazure.com/en-us/manage/linux/common-tasks/mongodb-on-a-linux-vm/
If you decide to use Windows Virtual Machine, you sure can use any MongoDB tutorial to install it on Windows box after configuring Windows Virtual Machine or just use this one.
As you have already tried using Powershell to deploy MongoDB from your desktop to Windows VM, but failed to get working, please write another question with error details and i sure can help.
Finally based on your actual objective I would suggest creating MongoDB on CentOS by following above tutorial and get your test done, which could be easiest MongoDB setup among all the methods we have talked.