ServiceStack web service hosting on monotouch/monodroid? - xamarin.ios

I'm currently trying to host a REST webservice on ios/android using Xamarin and monotouch/monodroid. I already successfully have a basic webserver running using HttpListener, but now I would like to host a complete webservice using ServiceStack.
monotouch/monodroid have very limited web hosting capabilities (HttpListener is basically the only way), but ServiceStack can in theory accomodate with that.
It seems to be possible as I found someone who did it: http://www.servicestack.net/mythz_blog/?p=417
The problem is that project does not work anymore on the last monotouch version, and ServiceStack seems to have removed server hosting capabilites in the monotouch/monodroid latest builds...
Xamarin have a fork of ServiceStack (https://github.com/xamarin/ServiceStack) which seems to have hosting capabilities, but the monotouch specific service hosting build does not compile, and the fork seems outdated.
Has anyone succeeded in making the ServiceStack hosting capabilities work on monotouch/monodroid? Or do you have an idea on how to make it work?

You might try this tutorial for self-hosting ServiceStack.
It looks like it will use HttpListener under the hood, but I don't know if the AppHostHttpListenerBase class will compile for MonoTouch/Mono for Android or not.

Ok so after some research, the project to allow ServiceStack self-hosting has been dropped. It had a better luck with the (old) Xamarin version (https://github.com/xamarin/ServiceStack) and could compile it and make it work somehow.
Since I need to be in sync with the latest ServiceStack version, I guess that I have no other choice than to roll my own adaptation, using the old Xamarin branch as a starting point.

Related

How does NSwag works in ASP.Net Zero framework?

I tried working on an ASP.Net Zero and it works and I have used its built in PowerTools to create CRUD functionalities of the system. And I tried adding some manual front-end Angular UI in the client side of the application. I'm just not sure what will happen if I run the "refresh.bat" command in NSwag if it will erased all of my manually created UI and service proxies. Please help me.
Create a git branch and examine changes after you try it. Discard all if not acceptable.
Refresh.bat will update and generate service proxy for implemented api on .Net backend.
Always let your Api server running whenever u want to run refresh.bat.

How would I go about publishing Orchard.Core so I could deploy to a web host?

In Orchard 1.x, my setup was the following:
Cloned Orchard 1.x and kept it clean (unedited) and updated on my local repo.
Publish that clone of Orchard 1.x to another local repo that I would keep clean and update from the clone above as necessary.
Create multiple clones for different landlord/tenant sites of the Publish of Orchard 1.x, and set each up remotely in separate Bitbucket repositories. These would have staging/production branches.
The above is just a simplistic version of what I actually did.
With Orchard.Core, since it's currently in Beta 2 (or 3, I think), documentation is still being created. In some instances of documentation, I get the impression I can do a similar thing as the directions are to download the source and reference the appropriate NuGet packages. But I don't see much of anything specific about publish/deploy (except some information from blog posts from about a year ago - which is likely stale).
On the other hand, I see some blog posts mentioning that all you really need to do is reference the NuGet packages to run a site locally, but there is no further insight into the publish/deploy scenario. I can infer that maybe just publishing that might be sufficient, but I am not sure.
As it's still in beta, I have no intention of pushing Orchard.Core out on a live site. I just want to start preparing for when 2.0 arrives. I can test out locally whether or not what I did with Orchard 1.x will work with Orchard.Core, but I want to make sure I do it correctly. Just concerned I might be missing something.
Can anyone confirm the publish/deploy steps for Orchard.Core currently? Any insight is appreciated.
Yes, you can publish the application.
Then, if you are on Windows and want to host it on IIS, you will need install the .NET Core Framework and the ANCM (ASP.NET Core hosting module).
In IIS, create a site pointing to the publish folder, with an application pool with 'No Managed Code' for '.NET CLR version' and 'Integrated' for 'Managed Pipeline Mode'.

System.TypeLoadException on Azure App Service

I'm running an asp.net 4.6 app on the app service. Just removed mvc from the site and using url rewrite to run an mvc free angular spa with a webapi.
Now it's asking for a type that was renamed months ago and works in pre mvc removal builds. I don't think it's got something to do with mvc though.
In trying to solve this I've xeroxed my local bin folder onto the server and the error still persists. So some sort of server config?
Has anyone ever experienced this before?
The error means that you are using a type which is not found in your assembly. To troubleshoot this issue, you need to find where you used this type. I suggest you use the Find in files feature provided by Visual Studio by pressing Ctrl+Shift+F. After found the place which used the type, you just need to delete it and rebuild your application.

ServiceStack Client on Xamarin.Mac (not iOS)

I have a Xamarin.Mac Unified API project with ServiceStack Client v4.0.38. I get the good old "System.ArgumentException: PclExport.Instance needs to be initialized" when trying to instantiate JsonServiceClient.
If I was on iOS, I would call IosPclExportClient.Configure() and life would be good. However, I can't find the equivalent for Mac. I would expect something like MacPclExportClient.Configure().
Any idea how to get the ServiceStack Client to work on Xamarin.Mac?
The IosPclExportClient should still be available for Unified API Projects as well, e.g:
ServiceStack.IosPclExportClient.Configure();

Servicestack - run built-in clients on the .net client profile framework

Is it possible to run servicestack's built-in clients on the .net client profile framework?
When i change the target framework property in the project settings to ".Net Framework Client Profile" and try to compile i get the following message: the namespace ServiceClient does not exist in the namespace servicestack.
We use servicestack services to send exception reports. We use the JsonServiceClient and feel really comfortable with it. We could change the target framework - but then we have to check all installations for the availability of the full .net framework.
Any idea how to solve this?
Thanks.
From the package contents of the latest ServiceStack.Common package there seems to be no -client version included (See Common Framework and Profile Targeting Examples under NuGet - Creating and Publishing a Package).
You should either change the target framework the full profile or pull the code from ServiceStack's GitHub Repo and try to build it for client profile yourself. The downside of this is that you will loose Nuget's awesome update features...
You could off course file an issue at GitHub for the guys maintaining ServiceStack to add a client profile version of the framework, but I guess that there's a good reason for why it's not there already.

Resources