LocalDb as storage for WCF service - c#

I am planning the following and I am asking for advice / critics on the setup.
We want to move our user management code to a WCF service so that our client apps retrieve user data through that WCF API only.
The API (library) shall be using LocalDb for storage as default.
The WCF service shall use the library and expose its functionality.
Is that a sensible approach? We want to keep the user storage close to the service, but does LocalDb run when we install the service running as NetworkService? We can go with LocalSystem but only if required, of course.
If running as a service, would another services (e.g. both running as LocalSystem) be able to access the LocalDb?
Considering deployment: If the API creates / connects the LocalDb, would any other restrictions apply to deployment of the WCF service via MSI other than ".Net 4.0.2 needed"?

Related

Host legacy WCF services in Azure

Does anyone know what the options are for hosting legacy .NET4+ WCF services in Azure?
I have heard that App Services are not to be used, but I have trouble finding any sources.
You can host your WCF services in multiple ways
on IIS
as Windows Service
as Console App
For the windows Service / Console App, you can:
Setup a VM and also install it
For the other options:
You can deploy on App Service or also on a VM with IIS installed.
More info:
https://aspdotnetcodehelp.wordpress.com/2017/11/13/hosting-wcf-in-azure-app-service/
The basic areas to consider when migrating an existing .NET application to Azure are:
https://learn.microsoft.com/en-us/dotnet/azure/migration/choose
Compute choices
Database choices
Networking and security considerations
Authentication and authorization considerations
To host a WCF service in Azure, you can check out the following tutorials.
Expose an on-premises WCF service to a web application in the cloud by using Azure Relay
Deploying an existing WCF service to Azure

HTML5 with .NET backend App, compatible with both standalone Windows and Azure?

I need to design an HTML 5 responsive, and simple app that should work on both internal Win server and on Azure.Our Client wants to check out Azure but maybe later he will want this app to be on its own on premise servers. Our Developers are almost all .NET back ends, with basic knowledge in HTML 5, Javascript, Jquery, and bootstrap. We accepted the challenge because the project is tiny and interesting, the point is, is possible to have 1 project that can be deployed to azure or IIS with no problem? and what kind of project should we create? I think that a simple asp.net project with some web methods and js will do the job, but I don't know if it will work on azure too. Back n 2010 I did something that way but now I am not sure it's still valid
Important: the web application should be able to query oracle on premise server, via web service but not sure if take azure service bus or azure vpn
It depends on how you build your application. I have built applications in the past that works both on-premise and on Azure. As long as you don't access any Azure specific features, there's no problem to deploying the web application project to an on-premise IIS.
If you use Azure-specific features or services from Azure, such as Azure SQL DB, you have to built an on-premise version. In my case it was simple as changing the connection string and the rest was done by Entity Framework, but you can use an IoC container, such as Unity, to change your implementation based on the environment you're running on. If the Azure environment is available (check through RoleEnvironment.IsAvailable) you resolve the Azure-specific implementation of some features and if not the on-premise implementation. In most cases that are just a few dependencies, for example if you use a worker role on Azure and a Windows Service on-premise.

How to deploy a web application with WCF as a cloud service using Windows Azure Pack?

We want to develop a web application as a cloud service on windows Azure. The application has the following architecture:
This application was a simple line of business winforms application, where any customer could purchase and use it. Now our company decided to redesign it as a web application where many customers can work on it in the same time. The core application will stay the same, just some simple customizations, it does some simple tasks in the database and sending emails and other things.
Now, Our company decided that we need to use windows Azure to publish the web application as a could service. We don't need to use any of the Azure storage nor SQL Azure database services, instead we will use our datacenter's storages and database. We just need to deploy the application as a cloud service, and we don't know where to start. I couldn't understand how to use windows Azure cloud services in this application. So my questions are:
Is this architecture valid with windows Azure? And where would be the role of Windows Azure and its cloud services in this archticture?
We don't need to host the application on Microsoft datacenters, instead we need to use it in our datacenter, when I searched I found the Windows Azure Pack for Windows Server, so can we use it so that we can host it in our datacenter? Does we need any extra cost consideration to use it? Where to start to use in our application?
I found some posts and tutorials (like this one here in SO) saying that I just have to create a new Window Azure Project and add a WCF Service Web Role, copy the application files from the old Web Service then host the same as a web application. Is that true? Is windows Azure just involved in the deployment and it doesn't has any effects in the internal architecture of the application?
You can deploy both your UI and Service back-end to Azure Web Roles. If you have any remaining WinForms application, they still can connect to the Service back-end. I would recommend that you also deploy your database to Azure if possible to improve performance and reduce latency. You can either use Azure SQL Database or you can create a SQL Server VM.
There are various interesting options to deploy layered applications to Windows Azure. You can read more about it here. http://serena-yeoh.blogspot.com/2014/01/layered-applications-and-windows-azure.html
You can also checkout a simple sample here
http://cloudsample.codeplex.com

What are the limitations , if any , when hosting a WCF service on azure

I wrote a WCF service and I want to host it in azure. When I wrote the service , I didn't have in my mind that I am going to host it in azure.
Every application , even a WCF service , is using platform resources. When I say resource , I mean anything:
memory
CPU
File handle
Low level APIs (pinvoke)
Com objects.
sockets
.Net BCL API (Yep , I even consider this as a resource)
Databases
etc..etc.. (anything that is not the code i have written myself)
Hypothetical example : If the service , for example , logs to Drive 'H' , it may work on my computer(since I have drive 'H') , but it will probably won't work on the cloud. Same for Drive 'C' , or any drive letter , I don't even know how a file system is seen from the service perspective.
This is just one example.
Another hypothetical example : I can pinvoke from the service some winapi method in nt.dll , It will work on my computer. But i guess it won't work on the cloud.
My question is :
How can I know what kind of resources can be used on the cloud and how resources are used when writing to the cloud? What are the "rules" to follow? Also Is there any "Smart" Compiler that can ensure that my service is compatible with the cloud platform
I'll be glad to get any detailed explanation or a reference\book about this topic. I tried to find some info by googling but didn't find anything that cover it well enough.
Once i'll get the details i'll be able to make the nessecary porting to my service (if any needed at all).
The limitations depend on how you host your WCF Service:
Windows Azure Web Sites: This is a shared hosting model. If you deploy your WCF service in a web site you'll need to take that into account. This means you'll have limited access to disk, limited access to low level APIs, no way to use native libraries, ...
Windows Azure Web / Worker Roles (PAAS): Your application will be deployed in a Windows Server 2008 / 2012 VM. So if you want, you can leverage all functionalities you would use on a normal Virtual Machine (all "resources" you mention in your question). The only thing to keep in mind is that these virtual machines are non persisent (meaning all data you store on them could get lost) and that the load balancer is not sticky (could be an issue if you use WCF sessions). The fact that these machines are not persistent also means you cannot install a database server on them in a reliably way, but you can use an external database, like SQL Azure. The advantage of this solution is that the machines are maintained by the Fabric Controller, so you push your service package (the application) to Windows Azure, and the rest of the deployment is done for you.
Windows Azure Virtual Machines (IAAS): You get a machine like in Web / Worker Roles which allows you to use all "resources", but with even more control. The machines are persistent, meaning everything you store on them is persisted in Blob storage (if the machine crashes, you don't loose the data stored on the OS drive and data disks). This is the closest alternative to an on-premises deployment, but this also adds extra work. It will be up to you to manage deployments on all servers, to handle security updates, ... But in this case you could install your own database on a machine. Keep in mind that also here the load balancer is not sticky which could impact features like WCF session.
You can follow below mentioned Guidance for Using WCF in Windows Azure.
Deciding whether to run a WCF service in a web or worker role
WCF services can be hosted in either a web role or a worker role. Which type of role you decide to use depends on the type of WCF service you are writing
Running a WCF service in a web role
A WCF service that is set up for deployment to a Windows Azure web role uses the same setup and configuration as a WCF service hosted in IIS on on-premise servers.
Understanding WCF Security in Windows Azure
The security concerns for hosting a WCF service on Windows Azure is the same as those you encounter hosting the service in on-premise servers
Troubleshooting WCF in Windows Azure
You can troubleshoot performance issues for WCF services in Windows Azure using the same techniques that you use with WCF services hosted on-premise servers
For get more information check Guidance for Using WCF in Windows Azure Here
I hope this will help to you.

iPhone, WMI, iis service

I am thinking about writing an application that will monitor IIS Service with iPhone, and send notification, perform resets if an IIS goes down.
I dont want to create a web service to do that but rather connect to a machine, specifying credentials and then get data from the IIS Service state.
Is it even possible?
Is it possible with iPhone?
I need to make this app generic enough for people to use with their hosted web sites and monitor their health and being able to reset it and/or recycle AppPools. I cant implement a service for any hosted environment. I need to be able to give the iPhone users an ability to connect to their host and once you are connected to the machine and authenticated to perform WMIs the phone users can mess with the iis. Is it possible?
I see your point not wanting to use web service because you want to monitor and reset IIS service, while web service is based on IIS. How about RestFul service? I have created RestFul service based on OWIN (Open Web Interface for .Net) and Kayak. Kayak may have some examples there.
The cool thing about those tools or lib is that the framework is very simple and does not rely on IIS. You can provide two URLs, one for get and one for post. The former is to get status of IIS server and post is to reset IIS. Those services can be just XML of JSON based objects and it will be up to the the OWIN service to do the job on the back end. Another great feature of this is that you can even create the service in a console app or any other ways (Windows service or Window Form in system tray) on WindowsXP or Home version. The app will provide RestFul service based on HTTP with specific port.
RestFul service is available for variety of platforms, including iPhone.
Although IIS supports remote administration I doubt there's a way to implement it on the iPhone easily.
You could write an actual Windows Server (not a web service) you could connect to with a socket which can do all the monitoring instead though.

Categories

Resources