Linux. NET learning notes (7) and linux.net learning notes

Source: Internet
Author: User

Linux. NET learning notes (7) and linux.net learning notes

In the previous article, we briefly described how to deploy the first ASP. net mvc 5.0 program in Linux. NET. At present, Microsoft has proposed OWIN and is committed to developing VNext. In the next series, we will switch to OWIN.

Three weeks ago, I accidentally got a copy of SignalR Programming in Microsoft ASP. NET, which is about half done so far ). Although only the original English version is available at present, this book is very good. Even if you need to hold a dictionary to help you read it, it is worth it.

The development of OWIN is not only for traditional MS.. NET (normally running in Windows. NET) development is a new journey, for our Linux. NET development is also a new era. As for the benefits brought to us by the development of OWIN, I will give you a list of the following items at will:

(1) the code we write is more compatible and the project migration is more reliable (the premise is that the framework you use supports OWIN)

(2) the Community will be more active (because OWIN is more open, it encourages a group of people to turn their ideas into reality)

(3) We have more options for Web Server. You can use non-IIS to mount your site. (Of course, IIS is still the best choice in Windows, however, at present, IIS does not support OWIN. For the moment, users who want to try OWIN can only use Katana, but Jexus in Linux already supports it ).

(4) more ......

However, there are always two sides to everything. In addition to the huge benefits brought by OWIN, it also brings some additional attributes that are not good in the short term. The most direct thing is that it increases our learning costs, we need to learn more about VNext at the same time. NET knowledge and the new knowledge that comes along with VNext (this is required in year 35 ). However, we still have Visual Studio 2014 not officially released, and we have a little time to race against it. When everything is final, let's try again. Then we can only look at the back of others. After all, "Let's drink soup first and drink water later, you don't have to drink anything. "Am I right?

Back to the topic of this section. We will discuss and learn in this section:

(1) how to prepare for running the OWIN program in Linux. NET

(2) deploy two interesting SignalR demos to Linux. NET.

(3) take a ride and deploy NancyFx to Linux. NET

The relevant code in this article has been hosted on GitHub. You can click here to download it.

1. What do we need to prepare?

Since the OWIN protocol has not been proposed for too long, and many frameworks that support OWIN are based on FrameWork 4.5, in order to successfully deploy your program, use the latest version of Mono (Mono 3.4) as Linux.. NET runtime environment. Note that the official installation package for Mono 3.4.tar.gz lacks components, therefore, if you use official package compilation, an Error is reported. Here we provide the correct installation package. You can click here to download the package.

As for the OwinHost in Linux, Jexus has already taken the lead in providing support. You only need to move to the official website to download Jexus with a version of more than 5.6. You can also click here to download it directly.

The installation method is the same as before. You can go to Linux. NET learning notes (1.

In addition, the installation paths of Mono in this series are "/usr/local/mono/", which is different from the "/usr/" in many tutorials, therefore, if you choose to follow this series of tutorials, make sure that each step of the installation is completed and correct. Recently, many of my friends, Jexus, failed to run and could not find Mono. These are basically not set environment variables, causing the system to scan the directory without scanning the Mono installation directory, and then cannot find the bin/Mono. You can change the installation directory from "/usr/local/mono" to "/usr/", but I have read some articles, if a change occurs, the impact will be very great (I feel like writing a project, the article will become larger when there are more projects, and all the derived subclasses of the base class will suffer ), as a result, there is no change at all, and readers should pay attention to it. (Of course, there are stories in the selection of my directories. If you are interested, you can leave a message and share it with me ).

We have been using the Development Mode in Windows, Linux, and OWIN. In Windows, Katana is used as the Host, and Jexus is used as the Host to run. Readers who need to know how to install and use Katana can also go to "how to install and simply use OwinHost -- Katana".

 

2. Deploy two interesting SignalR programs to Linux. NET.

As a framework supporting the OWIN protocol, the SignalR framework can naturally be deployed to Linux. NET by mounting it to OwinHost. In this sample code, there are two demos Based on SignalR. I will not explain how this Demo is made here, I hope that I will have the opportunity to create a learning series of SignalR in the future (when I feel that I am not confused about SignalR), and then I will give a detailed explanation of SignalR. Now I will not mislead readers.

After getting the code, open it with Visual Studio. Demo1 is a simple online chat room.

First, create a new website configuration file in Jexus:

Then write the configuration in it (of course, it is recommended to directly copy a new default, and then directly change the parameters), and add the following statement in the last line:

OwinMain = Jws. OwinAdapter. MsOwin. dll, Jws. OwinAdapter. MsOwin. Adapter

The role of this statement is to notify and allow Jexus to support OWIN (I call it The OWIN mode ).

Then release our Demo to Linux:

Open the bin directory and add the Jexus universal adapter for OWIN to the bin. (For related components, click here to download them. For source code, click here to download them)

Find "Microsoft. AspNet. SignalR. Owin. dll" and change the suffix or delete it directly ()

Then restart Jexus, and then we can access the Jexus through a browser (website, large image in high definition ).

Interesting ~!

As for Demo2, the deployment method is the same as Demo1. After the deployment is successful, the effect is as follows (the website is also shown in the figure ):

The Guid box in the figure will follow the mouse and move the mouse through any browser. other browsers will synchronize the Guid location, which is interesting and interesting.

The following message is displayed:

(1) Restart Jexus after redeployment.

(2) This Demo may cause CPU spikes, especially in virtual machines.

 

3. Give NancyFX a ride

Some readers may know how to use NancyFX, and some websites based on the NancyFX framework. Like SignalR, NancyFX also supports the OWIN protocol, so it can be deployed to Linux from ipvs at any time. In fact, deploying NancyFX can be said to be just a matter of moving your fingers (without using some "special" components and code as standard ), compared with SignalR, SignalR is much simpler (in the previous two demos, SignalR was not successfully deployed at the time. Later, it was completed only after debugging with Yu neliu cloud, thank you for your technical support ).

Although I am not familiar with using NancyFX myself, it also allows NancyFX to take a ride and talk about how it is deployed.

In the sample code, ExtraDemo is a Demo Based on NancyFX. We can deploy it to the project file and then publish it directly to Linux.

Then add the Jexus adapter:

Restart Jexus to complete the deployment of NancyFX. Access page:

Currently, the framework supporting the OWIN protocol exists in addition to the two mentioned in the article. Due to limited capabilities, I have not tried these frameworks for the moment. Interested readers can try them on their own, of course, you are also welcome to share your experiences with us.

In the next article, we will analyze how the OwinHost and OWIN frameworks "communicate" and how they "Drive" The OWIN framework. See you later.


Full pdf version of matlab gui Design learning manual version 2, Author: Luo huafei [do not post those 118 pages on the Internet ,!

Zhidao.baidu.com/question/410770320.html

Someone looked for it in March. It seems that no one answered the question successfully ....

You can go to some places where the GUI designers gather to ask if anyone has this.
In addition, your problem category is also a bit problematic. How can you get it to office software.

You can also ask questions from experts or netizens who are active in GUI issues on Baidu. Ask them for help. They may help you solve the problem.

I hope you can find the information you need earlier ~~ Good luck

Export data as you go

To synchronize data on the phone to the computer, you must pay for the VIP. In addition, if you change your phone number, you still have to pay for the data you want to transfer.
We recommend that you choose a free and permanent billing method.
Dieci includes Android, Android, iphone, iPad, BlackBerry, windows Phone, Saipan, Java, and Web. All mobile phones can be installed and used, and data can be synchronized between mobile phones and webpages.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.