UWP install SQL Server Express or other pre requisites - c#

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?

Related

Detecting and installing SQL Server Express with UWP app

I have written an UWP app for managing employees, timesheets etc.
How do I detect if SQL Server Express is installed and if not installed how do I setup SQL Server Express on the client computer? Is it possible to do it without running the exe file in 'fulltrust'?
I would also like to include the setup files in my app package with the configuration file to run a silent install on the client computer.
I have looked for a answer on many pages but could not find a real straight forward answer.
Some help here would be much appreciated.
when you have access to your client computer, you can run a check program in your setup process via checking if MS SQL Server Express registry key exists or not. If it exists, then it is installed.
Read this doc from Microsoft, there is a code snippet in the doc you can use:
https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2005/express-administrator/bb264562(v=sql.90)?redirectedfrom=MSDN
What do you mean by 'auto-detect' MS SQL Server Express installed'? Not sure what's your use case here.
Normally, you can not auto detect database to use since in many cases there could be multiple databases installed in the environment, and you don't know which one is the right one you are going to use. You have to know which database you are going to use first.
However, if you insist to detect database, you can do the port scan in your network which is really not a good idea.
So guess maybe your use case is unique.

SQL notification problems upon Change from local IIS to azure APP

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.

c++/c# app to connect to linux server

I am planning to do an App either in c++/C# (through Visual Studio) in Windows 7.
OK what this app does is it will accept input through studio elements like text box or buttons ..then it should create an command based on input and run these command on the Linux server.
E.g : One simple example is to restart a certain process on a Linux machine
Now to proceed to my problem:
How do I connect my App to Linux machine?
I don't want to install any third party application as i am not allowed to do so.
If possible please list me the different ways i can do this
Well, you can do this. I am already familiar with this scenario. I have several application setup working this way. The only option that will allow you to do this without any 3rd party application is using SSH protocol.
The SSH protocol is the well known and most power full tool of linux sysadmins. You can execute any command over it on a linux box from any part of the world or any piece of shit which can run an SSH client. Ask me on comment if you need more info on this.
EDIT
One example, if you want to restart certain process.. You can pass the command over SSH as below.
ssh user#server_ip '/etc/init.d/httpd restart"
The above will restart the HTTPD(Apache) service.
Some libraries you can use in .NET
http://www.codeproject.com/Articles/11966/sharpSsh-A-Secure-Shell-SSH-library-for-NET
https://sshnet.codeplex.com/
I have not used above libraries in .Net, Instead I have done several things using linux box with python and bash.
if I understand correctly, to solve this you can implemente WebService.
But when you said :
I dont want to install any third party application as i am not allowed
to do so
I'm afraid you can not setup WebService on Linux server ?
Other possibility, use SSH if already install on linux server (some chance that is) and you probably could find a .Net lib to make SSH
This link will help .Net class to execute remotely on Linux over SSH?

C# Windows Application Deployment

I developed a windows application using C# that has a database. The database is attached to my local SQL Server Management Studio. Now, I want to deploy my application (C# + database) so that it can be simply installed on other computers using an installer (setup file). I'm so new in this field. Please guide me that what steps I should follow to do this. Thank you.
Follow these,
1) First get some idea on how to create MSI within Installer Class Read
2) Create a command prompt app which should have the logic to create a Database in local SQL server. Check my post here
3) Pack the command prompt exe with the MSI package.
4) Within the insatller class's Install() method write logic to execute the command prompt exe.
There are few things to consider before going for deployment.
Do you have a centralized application? Meaning do you want to host your database on server or you want to deploy on each users machine.If you want it to be centralized then how are you going to access the database. Does your current structure supports it? like are you using SOA to access db or anything else?
If you have decided that you want to deploy your database along with your application on your client machine then you will have to deploy your database along with your setup. You can read a tutorial here on how to achieve this.

Hosting MongoDB on Windows Azure for C# Access

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.

Categories