Rebus with .net core 7 TransactionScope - rebus

Now that .net core 7 supports Distributed Transactions at least for windows; how can we use this functionality in a rebus application.
For example reading or updating two different databases in a handler while HandleMessagesInsideTransactionScope() is enabled.
I have tried it but got some issues.
Regards

Related

design/structuring a large/enterprice signalr core project - multiple hubs? only one hub?

How to structure a SignalR core project for an enterprise application?
An application that has a lot of functionalities as so a lot of classes and methods to invoke.
Multiple hubs for different areas?
Only one hub that dispatch to different classes?
How to arrange the project folders?
I can't find any viable example over the simple tutorials?
Any suggestions?
I'm afraid that this question will be closed because it is not to a specific problem but I will put my suggestion.
Since you will do a lot with SignalR and it would need to resolve different specific problems I would recommend to create a .NET Core Web Application to connect your product with this service using SignalR. You should start first reading this SignalR documentation.
So you will have one app that is responsible to handle those connections and your app must have various hubs for different business logic. Create interfaces and managers that can be shared between hubs and inject the HubContext in the managers to call methods to the clients.
Since you mentioned enterprise application I would extremely recommend you to look at Azure SignalR to manage and handle your connections.
Are you planning on using ASP.NET 4.x framework or .NET Core?
ASP.NET Documentation states that it makes no difference between single and multiple hubs from a performance standpoint. ASP.NET Docs
That does not mean you may not have performance issues overall, that will highly depend on your design/implementation.
.NET Core does not appear to state either way. Core Docs
According to their GitHub repo, you can have multiple if you want. Understanding that one of the differences is that under .NET Core each hub will have its own client connection.

Service Fabric reliable service with .NET Core

So I am playing around with Service Fabric for rolling out a system to the cloud, and so far I have most of the stateless services ported over and running well using ASP.NET Core.
I have another set of services that need to be stateful, and I would like to leverage .NET Core for those services as well. For those I will need to run a custom TCP protocol, not HTTP/WebAPI/WCF.
So the question is; is this possible? The templates only have a ASP.NET Core stateless service template. Can I build something like a .NET Core console application to run as a "Reliable Service"? If so, is there any documentation on how to do this?
Yes, it's possible.
You can create the .NET 4.5.1 stateful service via the template, and then port that project to .NET Core - we've done this and it works just fine.
There doesn't appear to be any official documentation on this process.

How to explain Katana and OWIN in simple words and uses?

I have read many articles about the OWIN and Katana projects, but I could not get the whole picture of it.
For a normal web developer who uses ASP.NET:
What exactly is OWIN and what problems does it solve (in simple words). What is its relation to IIS?
Does OWIN replace IIS? if not, in what situations does OWIN best fit?
How could OWIN help me in my daily work projects?
How could OWIN help me in a self-improvement projects?
Regarding the comment above, OWIN is not a framework. OWIN is a specification on how web servers and web applications should be built in order to decouple them and allow movement of ASP.NET applications to environments which were not supported before.
Prior to OWIN, when building ASP.NET application, you were inherently bound to IIS due to the heavy dependency on System.Web assembly.
System.Web is something that has existed ever since ASP (non .NET version) and internally contains many things that you might not even need (such as Web Forms or URL Authorization), which by default all run on every request, thus consuming resources and making ASP.NET applications in general lot slower than its counterparts such as Node.js for example.
OWIN itself does not have any tools, libraries or anything else. It is just a specification.
Katana on the other hand, is a fully developed framework made to make a bridge between current ASP.NET frameworks and OWIN specification. At the moment, Katana has successfully adapted the following ASP.NET frameworks to OWIN:
Web API
Signal R
ASP.NET MVC and Web Forms are still running exclusively via System.Web, and in the long run there is a plan to decouple those as well.
On the other hand, IIS is a good, resourceful host for web servers. Entire ASP.NET performance issues using IIS has deep roots in System.Web only. Up until the recent time, when deciding how will you host your web server, you had two options:
IIS
Self-Host
So if you wanted a performance, you'd go for a self-host option. If you wanted a lot of out-of-the-box features that IIS provides, you'd go for IIS but you'd lose on performance.
Now, there is a 3rd option, a Microsoft library named Helios (current codename) which intends to remove System.Web out of the way, and allow you to use IIS on more "cleaner" way, without any unnecessary libraries or modules. Helios is now in pre-release version, and is waiting for more community feedback in order to make it fully supported Microsoft product.
Hope this explanation clarifies things better for you.
EDIT (Sep 2014):
With ASP.NET vNext being in development, Katana is slowly getting retired. Version 3.0 will most likely be last major release of Katana as a standalone framework.
However, all the concepts introduced with Katana are being integrated into ASP.NET vNext, meaning that programming model will be pretty much the same. Quote from forum post made by David Fowler (Architect of ASP.NET vNext):
vNext is the successor to Katana (which is why they look so similar).
Katana was the beginning of the break away from System.Web and to more
modular components for the web stack. You can see vNext as a
continuation of that work but going much further (new CLR, new Project
System, new http abstractions).
Everything that exists today in Katana will make it's way into vNext.
EDIT (Feb 2015):
ASP.NET vNext is now known as ASP.NET 5 and will be built on top of .NET Core 5. .NET Core 5 is lightweight factored version of .NET Framework, designed to support goals of ASP.NET 5 and .NET Native. However, ASP.NET 5 will be supported by .NET Framework 4.6 as well, that should become available together with .NET Core 5. Both ASP.NET 5 and .NET Core 5 will be licensed under MIT and will accept community contributions.
EDIT (May 2015):
Additionally, ASP.NET Web API brand will be discontinued, however it's technology will be base for new ASP.NET MVC 6. Previous ASP.NET MVC versions were built by implementing IHttpHandler, an interface defined in System.Web. ASP.NET MVC 6 removes that dependency, making it portable to various platforms and web servers.
EDIT (May 2016):
ASP.NET 5 will officially be renamed to ASP.NET Core starting with Release Candidate 2 that is scheduled to be released soon. Same will apply for Entity Framework 7 which will be renamed to Entity Framework Core. More information about official announcement and reasons behind it can be found on Scott Hanselman's blog post:
ASP.NET 5 is dead - Introducing ASP.NET Core 1.0 and .NET Core 1.0
EDIT (May 2016):
With the release of Release Candidate 2, ASP.NET Core has been modified so that future web apps are actually just .NET Core console apps setup to process incoming HTTP requests. This concept makes ASP.NET Core even more aligned with approach Microsoft has taken with microservices architecture support and its implementation through Azure Service Fabric. More information on can be found on official blog post:
Announcing ASP.NET Core RC2
If I have to define OWIN for myself, that would be: "The best ideas from the Ruby and Node.js web dev communities, coming to .NET"
But this would not help any ASP.NET developer. My own definition would be something along the lines of:
OWIN defines a standard interface between .NET web servers and web applications. The goal of the OWIN interface is to decouple server and application
If I have to answer the questions you've posed, then here it is:
OWIN is an interface specification. It decouples a web applications from IIS.
If you are using ready-made components (which is what Katana is), then some parts of the application functionality are much easier to implement compared compared to old ASP.NET. Authentication with third-party identity providers (Facebook, Twitter) is one example of this.
OWIN is essentially a collection of best practices, which have been proven in web development communities. It shows a way to implement web apps which is very open to extensibility. As each web developer should constantly be on the cutting edge of new technologies, this is one way to stay up to date with the whole web development community and not just .NET. If you learn OWIN, it would be much easier to learn other web development frameworks like Express for node.js or Rack for Ruby, because the practices they use are similar.
I will try to cover it from the practical perspective.
Katana is project name to implement OWIN in Microsoft.
What exactly is OWIN and what problems does it solve (in simple words). What is its relation to IIS?
OWIN (Open Web Interface for .NET) is a standard (OWIN Specification) and Katana is .NET library, you can get nuget from here. OWIN and Katana became somewhat synonymous on the web.
Before OWIN your only option was IIS with OWIN you can use any other application (that has entry point) as web server.
Does OWIN replace IIS? if not, in what situations does OWIN best fit?
No it does not replace IIS, you can use OWIN and IIS there's Microsoft.Owin.Host.SystemWeb nuget for that. It is best fit if you want to optimise/change the way it is handled in IIS, or you want to create your custom web server out of let's say Windows Forms Application.
How could OWIN help me in my daily work projects?
It could reduce your server running costs since your web servers do not need to run on IIS (Windows) anymore (Windows servers are more expensive than Unix based ones, and you could run it on Console Application under Mono in Linux).
How could OWIN help me in a self-improvement projects?
Learning Microsoft.Owin (and other related OWIN libraries) will improve your knowledge on how HTTP communication between client and web server works.
Good read if you want to understand more on what Katana and OWIN is.
What is OWIN?
OWIN stands for Open Web Interface for .NET. OWIN is a specification that describes how web development frameworks such as ASP.NET MVC should interact with the web servers. The goal of OWIN is to decouple web applications from the web server by introducing an abstraction layer. Such an abstraction enables you to run the same application on all the web servers that support OWIN. Additionally, it simplifies the overall system because the abstraction layer can provide a lightweight infrastructure to host the applications. IIS provides a rich set of features to the web applications. However, web applications may not need all these features. It might be sufficient for them to have minimal HTTP processing capabilities. OWIN compatible host can provide such a hosting environment to these applications. Moreover, you can define a pipeline of modules that are used during the request processing. An OWIN pipeline is a chain of OWIN compatible components through which a request passes.
What is Katana?
Katana is a set of components by Microsoft built using OWIN specifications. Some of these components include Web API, ASP.NET Identity and SignalR.
Above is extract from CodeGuru Article : http://www.codeguru.com/csharp/.net/net_asp/overview-of-owin-and-katana.htm

Upgrade production server from ASP.NET 2 to ASP.NET 4

I have a production server (Windows Server 2003 SP2), running several ASP.NET 2 apps under IIS6. New applications are developed using ASP.NET MVC 3 (Razor) and Entity Framework 4. Old applications are not to be touched.
Clearly, the following components need to be upgraded:
.NET framework (install 4.0 side by side with existing 1.0, 2.0, 3.5SP1)
ASP.NET (install v.4 side by side with 2.0)
I want to keep IIS6 to avoid surprises, but it needs to be configured for MVC 3 routing
Which installer(s) is the most appropriate in this case? There are too many different ones available from MS - full, client profile, web platform installer etc :(
Goal number one is the not to break existing apps and keep downtime to a reasonable minimum.
Use the Web Platform Installer; it's specifically meant to help you get exactly what you need to run things. In your case, it will install the full .NET 4.0 Framework, and the other things you need, assuming you make the correct selections with it.
Installing any of the components you speak of will not do anything to your existing applications, provided you don't misconfigure them in such a way as to improperly attempt to use the new frameworks. All of this stuff works side-by-side by default.

serialport communication .net 4.0 from a webpage

Looking for serial port communication using ASP.NET 4.0. I have a cardwriter/reader from IDTECH which talks through a comport. Is there any way to accomplish with .net through the web.
I read things but most of the topics on speaking about .net 2.0 and I was not sure if they created something to handle this in .net 4.0
Thanks
Anything written for .net 2 should work in .net 4 with some changes that occur between revisions. However, using the serial port from asp.net will not work on most servers as the user that the asp.net process is using won't have permission to access the hardware.
The only way around this would be to build the portion of the process that talks with the card reader/writer as a Windows service and add some method of communicating to the service from your asp.net application (TCP connection or something similar).
The only way this is possible is via a browser plugin. This has nothing to do with .NET (unless that's what you use to write your browser plugin).
Everything you see about issues with the .NET serial port control are referring to desktop applications. As a side note, most of the issues have been resolved in .NET 4.0, but not all. I've given up and now use CommStudio, which is available as an ActiveX control, so you may be able to access its methods from a web page.

Resources