ServiceStack as a ServiceLayer for MVC, WPF, WP7-8 - wpf

after bumping into ServiceStack i would like to explore the option to have ServiceStack as a ServiceLayer for my existing MVC4 Project. The goal is to create a servicelayer for all other platform options like wpf, windows phone...
My main issue is the existing mvc project and the need to continue to use the SimpleMembershipProvider. Is it possible to move all code of the default AccountController to the ServiceStack ServiceLayer and call it from the AccountControler (WebSecurity Class)? Has someone tried something like this or should i dump this code and start a ServiceStack specific Security Class?
Regards,
S. Mantziaris

The first part on service layer is in http://nuget.org/packages/ServiceStack.Host.Mvc/ (adding it to your MVC4 project via NuGet almost instantly gives your a working service layer, just run and check yourhost.com/api/metadata).
https://github.com/ServiceStack/SocialBootstrapApi gives you a detailed example how to do authentication and authorization the ServiceStack way.
Check these two answers on how to integrate ASP Membeship and ServiceStack:
https://stackoverflow.com/a/8715958/801189 and https://stackoverflow.com/a/15078308/801189

Related

GemBox WPF dependency does not work on App Service Azure deployment

I developed a test .NET Core Web App to which I added the .doc to .pdf conversion tool GemBox.
Their documentation for Azure deployment combined with .NET Core is limited to non-existing and their support guys could not help me with a clear solution either.
The error I get:
HTTP Error 500.31 - ANCM Failed to Find Native Dependencies Common
solutions to this issue: The specified version of
Microsoft.NetCore.App or Microsoft.AspNetCore.App was not found.
I tracked down the problem to the following issue:
GemBox.Document for .NET Core 3.0 uses WPF.
Is it possible that App Service added a limited support for WPF?
Thanks,
Lorena
The latest released version of GemBox.Document have cross-platform support for saving to PDF which doesn't have a WPF dependency, see the release post or the ASP.NET Core example.
So, you can now use GemBox.Document on Azure services, such as App Service, Azure Functions, etc. without any issue.

Moving angularJS site to Visual Studio?

So in my quest to learn front-end development (doing server side, WCF, etc for the past 4-5 years), I managed to create a simple little movie app just using javascript and html. When I created this app, I was using Sublime Text and since I'm a .NET developer, I'd like to move this site over to Visual Studio and actually wire it up to WebAPI or MVC and start talking to a database.
What is the best way to move over a pure html/javascript/css site into Visual Studio and wiring it up for db connectivity? I thought about just creating a web site project in a solution and start wiring it up to a BLL and DAL layer but I didn't know if that was ideal or not.
Any help would be appreciated.
Thanks!
IMO Your best bet is to create an empty WebAPi2 project in VS and create a folder called 'app' that you will move your Angular files into.
Right click your project and go to the Web tab. Set the start page to whatever HTML file is your main page.
You should now be able to just F5 and run the application. Then start creating WebApi controllers for your data layer and you should just able to hit the API from localhost/api (or whatever you designate in your routes)
AngularJS should be completely independent of the server language (php, c#) and server (nginx, apache, IIS) you run it on.
I have worked on angular projects that talk to C# WCF services and are hosted on IIS just fine. You best bet is to create restful services in WCF and use angular services and factories to pull that data into the client angular app.
I think the best place to start would be the $http service of Angularjs.
https://docs.angularjs.org/api/ng/service/$http

"Calls to the web service will fail..." Once Again

Last year someone reported encountering this problem ("The Silverlight project you are about to debug uses web services. Calls to the web service will fail unless the silverlight project is hosted in and launched from the same web project that contains the web services.") and accepted the answer to "set the web project which hosts the Silverlight application to be your startup project."
I'm seeing the same message, but think the solution might have to be different. I am building in VS 2010 a Silverlight application to access the Google Weather API, with VB as the code-behind. The API will return a XML file with data for the specified city (ex., "http://www.google.com/ig/api?weather=london,england"). The Solution Explorer only shows my VB/Silverlight project ("GetWeather"), and the Project Properties dialog box shows the Startup Object as "GetWeather.App" -- the only choice. I'm trying to use a WebClient object to make the call and an XDocument object to parse the return. But I repeatedly get the above error message, with no other result. What am I doing wrong?
Thank you in advance!
I would add a simple Web project and configure it to host the Silverlight app. You'll need to host the app somewhere anyways, so why not create a stub ASP.NET application in your solution? The easiest way is to create a new Silverlight app solution selecting an ASP.NET web project as the host, and then copying your existing code to that solution. Then you should set the web project as the startup one. This should make debugging a lot easier.
Besides, do remember to configure the client access policy to enable cross-domain calls. Check out this article

Send simple data from wp7 to winforms application

I want to send simple data (geolocation data to be precise) from Windows Phone 7 application to a windows forms application and use it, as I'm a total beginner in this field I don't know which tools to use.
I searched about wcf services and tested this method but there's some issues: the data is sent from the phone application but isn't sent to the winforms application (guess something is missing)
If your know how to do this in a quick way, or have good tutorials I'll be thankful.
EDIT
I found this tutorial, it show how to connect directly wp7 application and desktop application without using sockets neither wcf service, I'm wondering if it is really works if the application isn't in localhost.
the like for the tutorial: wp7 tutorial
I had a similar problem and so I created a REST/JSON WCF service hosted in IIS with AppHarbor to provide the data. There's hundreds of ways to do it (Ruby/Heroku, etc..), but that particular one fits well within the Microsoft stack. I also needed to share route data and I used the WCF service to wrap the BingMaps services so that route computations are cached and shared. Considering that I had already created a local model, moving it out of my phone project into a service took less than a few hours (including the usual config hiccups, and forgetting to add the appharbor user to my bitbucket repo).
Consuming the service from WinForms (or any client) shouldn't be an issue as the service knows nothing about the client implementation.
Here's a tutorial from code project. REST WCF Service with JSON
I think you would need to implement some sort of server side solution which you could upload to on your Windows Phone and download from on your Windows Form application. This could be achieved using a WCF service which was connected to a server side database.
Another option would be to use sockets and communicate directly with your WinForms application. Check this tutorial on how to use basic sockets on WP7.

Hosting legacy Silverlight application in an ASP.NET MVC3 web application

I am trying to convert an existing silverlight application to use a MVC web application versus a regular asp.net web application.
I have taken a look at fiddler and it is not able to access the domain service methods as the service does not exist (this is because these files are autogenerated once they are called with ria services). But with MVC since it looks for the controller if files don't physically exist we are getting this error.
I have tried to ignore svc files by:
routes.IgnoreRoute("{allsvc}", new { allsvc = #"..svc(/.*)?" });
and also have tried;
http://xamlcoder.com/blog/2010/01/15/upgrading-to-wcf-ria-services-asp-net-mvc-2/
With no success. Has anyone been able to successfully do this, if so, how?
Thanks in advance.

Resources