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

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.

Related

Using Azure SDK for JS to create .NET 4.x App Service

I'm starting to wonder whether this is the right tool for the job, still here goes.
I'm attempting to automate the creation of our Azure Test environment using Azure SDK for JS. The environment spans many services (as you can imagine), including Classic ASP.NET app services.
Node is my safe space, so that is why I started with the JS SDK.
I have started scripting the creation of an app service using WebSiteManagementClient.webApps.createOrUpdate. I'm confused though, there is seemingly no way to configure any of the following:
Which app service plan the app service should be connected to. This feels fundamental.
The operating system, Windows or Linux.
The stack version, .NET 4.8, .NET Core, or whatever.
Is it possible to configure the above using the JS SDK, or am I going to have find another approach?
Update 23/03/21
Untested, but these are my findings so far:
App Service Plan - The plan is set using the serverFarmId property of the Site interface.
Operating system - Assuming Windows as the default, if you want a Linux app service, you change the kind property of Site from app, to app,linux.
Stack & version - In the SiteConfig interface, you have linuxFxVersion and windowsFxVersion. Again, I think the assumption is 'latest .NET' (e.g. .NET 4.8). For .NET Core 3.1, the setting looks to be DOTNETCORE|3.1.
It can be achieved using js SDK. I checked the source code and it is ok. But I don't recommend to use js sdk to do this.
Because you need to call the SDK, there are many internal logics that you need to code. This will waste a lot of your time. So I recommend you to use restapi.
The restapi method name is similar to the naming in the SDK, mainly because you can test api interfaces online to achieve the functions you want. So you can selectively choose the method you want to achieve the function you want.
Official doc
Web Apps - Create Or Update
As for your concerns, you only need to write all the configuration in json format and put it in the request body.
Tips:
First use the online interface, encode the json format, create a webapp according to your needs, and then integrate it into your code.

Azure Function Structure

I'm trying to wrap my head around how we're supposed to build Azure functions.
I love the idea of building serverless, compact, single-function apps that respond to events.
Here are the problems I'm running into:
I have nice class libraries built in .NET Standard 2 that handle all my "backend needs" namely handling CRUD ops with Cosmos Db, Azure Table Storage, Azure SQL, Redis, Azure Storage. No matter what I did, I couldn't integrate these class libraries into an Azure Functions project. More details below.
Also, getting dependency injection in Azure Functions project has proven to be quite a task -- especially with my class libraries mentioned above.
At this point, the only option I'm seeing is to "copy and paste" code into a new Azure Functions project and use it without any DI.
This seems to go against "best practices". So what's the solution other than either to create monolithic code or wait till Azure Functions support .NET Core and DI.
I thought I could use my .NET Standard class libraries from a regular Azure Functions project targeting .NET Framework. After all, the idea of .NET Standard is to "standardize" things. I opened a couple of posts here on SO. I'm providing the links so that you can see the issues I've run into:
Using .NET Core 2.0 Libraries in WebJob Targeting .NET Framework 4.7
No parameterless constructor error in WebJobs with .NET Core and Ninject
P.S. My previous posts are referring to WebJobs. That was plan B approach because WebJobs seem half a step ahead of Azure Functions when it comes to supporting things like .NET Core and DI. Ultimately, I'd like to build a few Azure Functions that can use my class libraries built in .NET Standard 2.
Also, my previous posts mention that my class libraries target .NET Core 2.0. Since then I converted them to .NET Standard 2 which didn't really take much at all. I did this so that I truly conform to .NET Standard 2.
One issue is that Visual Studio has an outdated version of the Functions Core tools. Until this is resolved, you can work around in the following way:
Install the latest via npm by running npm install -g azure-functions-core-tools
In your Function App in VS, go to the Properties
Go to Debug, and click New... under Profile
Name the new Profile something like FunctionsNpm
Set the executable to (replace [YourUserName]): C:\Users\[YourUserName]\AppData\Roaming\npm\node_modules\azure-functions-core-tools\bin\func.exe
Set the arguments to host start
Set the working directory to $(TargetDir)
In toolbar, look for the green triangle icon to change your current Profile to the one you just created:
Now when you run from VS, you'll be using the npm tools instead of the older one that come with the VS package.
.NET Standard 2 support is on its way, see this github issue.

How to use kernal in ServiceStack version="4.0.36"

I want to use StandardKernel object in my IOC container for that I downloaded “ServiceStack.ContainerAdapter.Ninject”. this Ninject is dependency with ServiceStack.Common (≤ 3.9.59) but I AM using the latest version of ServiceStack version="4.0.36".
Can anyone suggest me how to use kernel in ServiceStack version="4.0.36".
IKernel kernel = new StandardKernel
According to the package's nuGet page , this package has a dependency on ServiceStack 3.9.59 and below. It doesn't appear to currently support the 4.x version of ServiceStack.
Looks like the code is hosted on github. You could contact the author and ask him about supporting 4.x or you could fork it, make it compatible with 4.x and then submit a pull request.

Designing ServiceStack with RedisMQ

I am implementing a solution that has a web interface (service stack) and a long running job service (servicestack?).
I already implemented the web interface and found servicestack a really good framework for creating what i wanted. I used redis as a semi reliable object store.
Then i started to think about how to implement the job service.
What i originally thought i do was to set up a simple windows service and have the redis client pick up thinks marked for the job service ( how exactly i wasn't sure ). These are very long running jobs that require alot of resources so i want to throttle how many of them are running at a time and also if i could fan out with worker machines that would be nice.
Then i saw that ServiceStack has a RedisMQ that might fit the bill, and hence the question.
Should i create a seperate servicestack service and host it in a windows service. Then have a MQ interface on it and let the webservice post to that message queue jobs that need to run. Then the jobservice is decoulpled from the webservice and all is well.
or
Am i over thinking it and should just use the logic part of the service i already have running and implement the job logic there, could pop in a MQ but in the same process that would probably just be a waste of time. I could skip the message part entirely and just call the logic part straight with some throttling algorithm.
Also when i was testing this out i had trouble with creating the RedisMQ server
using ServiceStack.redis;
using ServiceStack.messaging;
var mqHost = new RedisMqServer(redisFactory, retryCount:2);
Returns RedisMQServer not found.
I did a full nuget install of the servicestack and servicestack.redis packages
install-package servicestack
install-package servicestack.redis
When i use object browser on the .dll i don't find any mention of the ReidsMQServer, the version i 4.0.15
I found this url https://github.com/ServiceStack/ServiceStack/blob/master/src/ServiceStack.Server/Messaging/Redis/RedisMqServer.cs
And would think that this should belong to the servicestack.redis reference.
Any help appreciated,
cheers
Redis MQ is in the ServiceStack.Server NuGet package, i.e:
PM> Install-Package ServiceStack.Server
When in doubt as to which package to install, refer to ServiceStack's download page, e.g: https://servicestack.net/download#mq

ServiceStack web service hosting on monotouch/monodroid?

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.

Resources