Remoting简单实例(新手的福音)
1、创建远程对象,程序集为RemoteHello.dll,类库建立如下:
using System;
using System.Collections.Generic;
using System.Text;
namespace RemoteHello {
[Serializable]
public class Hello : System.MarshalByRefObject {
public Hello() {
Console.WriteLine("Constructor called");
}
~Hello() {
Console.WriteLine("Destructor called");
}
public string HelloWorld(string name) {
Console.WriteLine("Hello World!");
return"Hi," + name;
}
}
}
2、创建服务器,需要引用System.Runtime.Remoting程序集和之前创建的RemoteHello.dll程序集,控制台程序建立如下:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting;
using RemoteHello;
using System.Runtime.Remoting.Channels.Tcp;
namespace HelloService {
class HelloServer {
static void Main(string[] args) {
TcpServerChannel channel = new TcpServerChannel(8888);
ChannelServices.RegisterChannel(channel, false);
RemotingConfiguration.RegisterWellKnownServiceType(typeof(Hello), "HelloWorld", WellKnownObjectMode.SingleCall);
System.Console.WriteLine("Press Any Key to Exit ! ");
System.Console.ReadLine();
}
}
}
3、创建客户端,需要引用System.Runtime.Remoting程序集和之前创建的RemoteHello.dll程序集,控制台程序建立如下:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Remoting.Channels;
using RemoteHello;
using System.Runtime.Remoting.Channels.Tcp;
namespace HelloClient {
class HelloClient {
static void Main(string[] args) {
ChannelServices.RegisterChannel(new TcpClientChannel(), false); Hello obj = (Hello)Activator.GetObject(typeof(Hello),
"tcp://localhost:8888/HelloWorld");
if (obj == null) {
Console.WriteLine("False to Link Server.");
return;
}
while (1==1) {
Console.WriteLine(obj.HelloWorld(System.Console.ReadLine())); }
System.Console.ReadLine();
}
}
}。
Remoting
一、Remoting基础什么是Remoting,简而言之,我们可以将其看作是一种分布式处理方式。
从微软的产品角度来看,可以说Remoting就是DCOM的一种升级,它改善了很多功能,并极好的融合到.Net平台下。
Mic rosoft® .NET Remoting 提供了一种允许对象通过应用程序域与另一对象进行交互的框架。
这也正是我们使用Remoting的原因。
为什么呢?在Windows操作系统中,是将应用程序分离为单独的进程。
这个进程形成了应用程序代码和数据周围的一道边界。
如果不采用进程间通信(RPC)机制,则在一个进程中执行的代码就不能访问另一进程。
这是一种操作系统对应用程序的保护机制。
然而在某些情况下,我们需要跨过应用程序域,与另外的应用程序域进行通信,即穿越边界。
在Remoting中是通过通道(channel)来实现两个应用程序域之间对象的通信的。
如图所示:首先,客户端通过Remoting,访问通道以获得服务端对象,再通过代理解析为客户端对象。
这就提供一种可能性,即以服务的方式来发布服务器对象。
远程对象代码可以运行在服务器上(如服务器激活的对象和客户端激活的对象),然后客户端再通过Remoting连接服务器,获得该服务对象并通过序列化在客户端运行。
在Remoting中,对于要传递的对象,设计者除了需要了解通道的类型和端口号之外,无需再了解数据包的格式。
但必须注意的是,客户端在获取服务器端对象时,并不是获得实际的服务端对象,而是获得它的引用。
这既保证了客户端和服务器端有关对象的松散耦合,同时也优化了通信的性能。
1、Remoting的两种通道Remoting的通道主要有两种:Tcp和Http。
在.Net中,System.Runtime.Remoting.Channel中定义了IChannel接口。
IChannel接口包括了TcpChannel通道类型和Http通道类型。
它们分别对应Rem oting通道的这两种类型。
用英文写做菜步骤作文
用英文写做菜步骤作文英文:Cooking is one of my favorite things to do. I love the process of preparing ingredients, experimenting with flavors, and finally presenting a delicious dish. Here are the steps I usually take when cooking a meal:1. Plan the meal: Before I start cooking, I like to plan out what I'm going to make. I think about what ingredients I have on hand and what I need to buy, and then I come up with a rough idea of what the finished dish will look like.2. Prep the ingredients: Once I know what I'm going to make, I start prepping the ingredients. This might involve chopping vegetables, marinating meat, or measuring out spices.3. Cook the dish: With all the ingredients prepped,it's time to start cooking! I usually start by heating up some oil in a pan, and then I add the main ingredients (like meat or vegetables) and cook them until they're browned or softened. Then I add any other ingredients (like sauce or spices) and let everything simmer together.4. Taste and adjust: Once the dish is cooked, I always taste it to make sure it's seasoned correctly. If it needs more salt, pepper, or other spices, I add them in and taste again.5. Serve and enjoy: Finally, it's time to plate the dish and enjoy it! I like to garnish with fresh herbs or a sprinkle of cheese before serving.中文:做饭是我最喜欢的事情之一。
做饭步骤英语作文
做饭步骤英语作文Introduction:Cooking a meal can be a delightful and rewarding experience. Whether you're a seasoned chef or a beginner in the kitchen, following a clear set of steps can make the process enjoyable and the result delicious.Step 1: Plan Your MealStart by deciding what you want to cook. Consider the ingredients you have on hand and what you're in the mood for. Make a list of the ingredients you'll need and check if you have them all.Step 2: Gather Your IngredientsCollect all the necessary ingredients before you begin cooking. This will help you stay organized and ensure that you don't run out of anything midway through the cooking process.Step 3: Prepare Your IngredientsWash and chop vegetables, measure out spices, and prepare any proteins you'll be using. Having everything ready to go will make the cooking process smoother.Step 4: Preheat Your Oven or StovetopIf you're baking or sautéing, make sure your oven or stovetop is preheated to the correct temperature. This will ensure even cooking and help prevent overcooking orundercooking.Step 5: Cook in StagesBegin by cooking the main components of your meal, such as proteins or pasta. Once those are cooked, move on to the secondary elements like vegetables or sauces.Step 6: Season Your FoodSeasoning is key to bringing out the flavors in your food. Add salt, pepper, and any other spices or herbs you're using throughout the cooking process.Step 7: Taste and AdjustAs you cook, taste your food and adjust the seasoning as needed. This will help you achieve the perfect balance of flavors.Step 8: Serve Your MealOnce everything is cooked to perfection, it's time to serve. Plate your food in an appealing way, garnish if desired, and enjoy the fruits of your labor.Conclusion:Cooking a meal is a process that can be broken down into simple, manageable steps. By following these steps, you can create a delicious and satisfying meal that you can be proud of. Remember, practice makes perfect, so don't be discouraged if your first few attempts aren't perfect. Keep trying, and soon you'll be cooking like a pro.。
用英语写做饭的全过程作文
用英语写做饭的全过程作文Cooking is not just about preparing food; it's a journey of flavors, techniques, and creativity. Here’s a detailed look at the process of cooking a delicious meal from start to finish.1. Gathering Ingredients:The first step in cooking any dish is gathering all the necessary ingredients. This involves checking your pantry and refrigerator to ensure you have everything required. For example, for a pasta dish, you might need pasta, tomatoes, garlic, olive oil, herbs, and cheese.2. Preparation:Once you have all your ingredients, the next step is preparation. This includes washing and chopping vegetables, measuring out spices, and preparing any proteins such as meat or tofu. Each ingredient is prepared according to the recipe's instructions to ensure uniform cooking and proper flavor integration.3. Cooking Process:- Heating the Pan: Start by heating a pan or pot over medium heat. Add a small amount of oil or butter depending on the recipe.- Sautéing: Begin cooking by sautéing aromatics like onions, garlic, or ginger until they are fragrant and lightly browned.- Adding Ingredients: Add ingredients in stages, starting with those that require the longest cooking time. This could include proteins or dense vegetables.- Seasoning: Throughout the cooking process, add salt, pepper, herbs, and spices to enhance flavors.- Simmering or Boiling: Adjust heat as needed and allow the mixture to simmer or boil according to the recipe until ingredients are tender and flavors are well combined.- Tasting and Adjusting: Taste the dish periodically and adjust seasoning or flavors as necessary.4. Plating:Once the dish is cooked to perfection, it's time to plate. Arrange the food attractively on plates or in bowls, considering both visual appeal and portion sizes.5. Garnishing:Garnishing adds a final touch to your dish. This could involve sprinkling chopped herbs, drizzling a sauce, or adding a dash of freshly ground pepper.6. Presentation:Presentation is key to making your dish inviting. Pay attention to how you arrange the food on the plate, ensuring it looks appetizing and appealing.7. Enjoying the Meal:Finally, sit down and enjoy the meal you've prepared. Share it with family or friends ifpossible, savoring the flavors and textures you've created through your cooking process.Cooking is a blend of skill, creativity, and passion. Each step contributes to the overall experience, turning simple ingredients into a delightful culinary creation.。
B+ 情景对话 RESIGNING 教师用
RESIGNINGGeorge: I’ve run out of steam. To be honest, I want to be in a different environment. Manager: Is that so?George: Yes, I don’t want to be stuck in a rut. I want to move on.Manager: Have you decided?George: Yes, I want to get a better job.Manager: Could you tell me why you want to quit?George: I’m quitting because of the lousy salary and all the difficulties I have in getting along with my colleagues.Manager: Oh, that sounds terrible. Would you be happier with higher pay here? I’m sure something can be worked out.George: I’m afraid not. I’ve promised my girlfriend. We’re going to travel south to find jobs that offer higher pay.Manager: OK. I’d like to say that I’ve really enjoyed working with you. However, I think you should work harder at your new job and then you can ask for higher pay. 1). Run out of steam= run out of gas (对所做的事情)不再有精力和兴趣Eg. The home team seemed to run out of steam before the game was over.比赛结束前,主队好像精疲力尽打不起精神了。
趣味三字经
学会ride,妈妈pride。 清晨jog,带上dog,踩到frog。 轻轻hop,跳上top, 唱起pop。 把眼close,用我nose,去闻rose。 • 个子short,喜欢sport,跑到airport。 • 拿着fork,吃着pork。 • 一个nurse,丢了purse。 • 买只turtle,颜色purple。 • 一只goat,穿件coat,上了boat。 • 一片oat,卡在throat。 • 燃烧oil,直到boil,倒进soil。 • 是否join,抛起coin。
Once in a blue moon 千载难e-sky market 露天市场 White lie 善意的谎言 white elephant 累赘,无用之物 white night 不眠夜,(夏季高纬度地区所 见的)白夜 white coffee 加牛奶的咖啡 white collar workers 白领工人
Green hand 新手 green-eyed 红眼,嫉妒 green house effect 温室效应 green-thumb 有特殊园艺才能 He is as green as grass.他还是个孩子。 as green as grass:幼稚的,浑然无知 的
喝着coke,听着joke,把腰broke。 举着gun,瞄准sun,不停run。 小小bug,把我hug。 找个excuse,借车use,遭到refuse。 假装mute,真是cute。 开着car,向着star,路途far。 想变smart,必须start ,学习art。 一个driver,掉进river,生命over。 一个robber,专抢 rubber。 穿上shirt,脱下skirt,扔进dirt。 这只bird,总跑third。
英文 三字趣味经:
asp.netremoting学习
remoting 学习前言------------------本文介绍了一种全新的调用远程代码的技术。
参考了微软的remoting、webservice。
基础知识------------------先抛开具体的代码,如果要实现远程代码调用,一个最简单的模型是:1. 使用一个HttpHandler,当有请求的时候,调用对应的代码,返回。
例如:代码class RemoteHandler : IHttpHandler, IReadOnlySessionState { public bool IsReusable { get{ return true; } } public void ProcessRequest(HttpContext context){ //这里创建实例RemotingGreetingRemotingGreeting greeting = new RemotingGreeting();byte[] response = greeting.Helloworld(); //这里返回调用结果到客户端context.Response.Clear();context.Response.ContentType ="application/octet-stream"; BinaryWriter writer = newBinaryWriter(context.Response.OutputStream);writer.Write(response); writer.Flush(); writer.Close();context.Response.End(); } }2. 客户端使用Http去访问这个Handler,就实现了最原始的远程调用。
这段代码,就实现了远程调用RemotingGreeting这个类,获取方法Helloworld();的返回值。
那么,这个过程如何实现通用呢?如何实现框架化?首先先看看实际代码的调用效果:代码实例------------------首先声明一个被远程调用的对象,RemotingGreeting. 以及一个接口IRemotingGreeing代码class RemotingGreeting : IRemotingGreeting{ public string Greeting(string message){ return "Hi! " + message; } } [Remote("Pixysoft.Framework.Remoting.Demo", "Pixysoft.Framework.Remoting.Demo.RemotingGreeting") ]//这里实际指定了接口具体实现的类的Assembly和Type public interface IRemotingGreeting { string Greeting(string message); }然后本地实现远程调用:using System;using System.Collections.Generic;using System.Text;namespacePixysoft.Framework.Remoting.Demo{ class testcase { public void test() { //指定了调用的入口点url string url ="http://localhost:1300/Apis/remoting.asmx"; //创建本地调用的透明代理IRemoteChannel<IRemotingGreeting> channel = RemotingManager.CreateRemoteChannel<IRemotingGr eeting>(url); //登录远程服务器channel.Login("xxxxxx", "xxxxxxxxx"); //远程调用string greeting =channel.RemoteProxy.Greeting("pixysoft"); //登出channel.Logout(); //打印结果,就是“Hi!pixysoft”Console.WriteLine(greeting); } }}------------------远程调用框架的思路是:1. 本地创建一个透明代理(RealProxy.GetTransparentProxy())2. 用户本地的请求,被透明代理序列化为XML3. XML传递到服务器的Handler,被解析后,加载对应的对象(Spring? 动态加载)4. Handler运行对象,获取返回值,再序列化为XML,返回本地。
i remember作文英语三段式
i remember作文英语三段式I remember the first time I rode a bike without training wheels. It was a sunny afternoon, and my dad was patiently holding onto the back of my bike, guiding me along the sidewalk. I could feel the wind in my hair and the excitement building in my chest.As we reached the end of the street, my dad let go of the bike, and I was on my own. I wobbled for a moment, but then I found my balance and started pedaling faster and faster. The feeling of freedom and independence was exhilarating, and I knew that I had finally mastered a new skill.I remember the time I won my first spelling bee in elementary school. I had spent weeks studying the word list and practicing with my mom every night. When the day of the competition arrived, I was nervous but determined to do my best. As the announcer called out the words, I spelled each one with confidence and precision. When it came down to the final round, I was up against my toughest competitor. The word was "champion," and I spelled it flawlessly. The crowd erupted into cheers, and I was overcome with a sense of accomplishment. Winning that spelling bee taught me the importance of hard work and perseverance.I remember the day I graduated from college. It was a bittersweet moment, as I was excited to start a new chapter in my life but also sad to say goodbye to the friends and professors who had supported me along the way. As I walked across the stage to receive my diploma, I felt a sense of pride and accomplishment wash over me. All the late nights studying, the stress of exams, and the challenges I had overcome had led to this moment.I knew that I was ready to take on whatever the future held for me. Graduating from college was a milestone that I will always cherish and remember as a turning point in my life.。
做饭全过程英语作文高中
做饭全过程英语作文高中Title: The Complete Process of Cooking A High School Essay。
Cooking is both an art and a science. It involves a series of steps, from selecting ingredients to presenting the final dish. In this essay, we will explore the complete process of cooking, from start to finish.1. Gathering Ingredients:The first step in cooking is gathering all the necessary ingredients. This involves making a list of what is needed and then heading to the grocery store. It's important to choose fresh, high-quality ingredients to ensure the best flavor in the final dish.2. Preparation:Once all the ingredients are collected, it's time toprepare them for cooking. This may involve washing and chopping vegetables, marinating meat, or preheating the oven. Proper preparation ensures that everything is readyto go once cooking begins.3. Cooking Techniques:There are many different cooking techniques, each suited to different types of food. Some common techniques include frying, baking, boiling, steaming, and grilling.The choice of technique depends on the dish being prepared and personal preference.4. Seasoning and Flavoring:Seasoning and flavoring are crucial steps in cooking. This is where herbs, spices, and other ingredients are added to enhance the taste of the dish. It's important to strike the right balance of flavors, taking into account factors such as sweetness, saltiness, sourness, and spiciness.5. Cooking Time and Temperature:Knowing the correct cooking time and temperature is essential for achieving the desired results. Overcooking or undercooking can ruin a dish, so it's important to follow recipes carefully and use kitchen tools such as thermometers to monitor temperature.6. Plating and Presentation:The final step in cooking is plating and presentation. This is where the dish is arranged on a plate or platter in an attractive manner. Garnishes may be added to enhance visual appeal, and sauces may be drizzled for added flavor. Presentation is key, as it can greatly influence the overall dining experience.7. Enjoying the Meal:After all the hard work of gathering ingredients, preparing, cooking, and presenting the dish, the final step is to sit down and enjoy the meal. Sharing food with othersis a social activity that brings people together and creates lasting memories.In conclusion, cooking is a multi-step process that requires careful planning, attention to detail, and creativity. Whether you're whipping up a simple weeknight dinner or preparing a gourmet feast, following these steps will help you achieve delicious results every time. So next time you step into the kitchen, remember the complete process of cooking and get ready to create something amazing.。
英语做饭的过程作文
英语做饭的过程作文Sure, here's a composition about the process of cooking in English:The Joy of Cooking: A Step-by-Step JourneyCooking is an art that transforms simple ingredients into a symphony of flavors. It's a process that requires precision, creativity, and a dash of patience. Here's how I approach cooking a meal, step by step.Step 1: Planning the MenuThe first step in my cooking process is deciding what to cook. This involves considering the dietary preferences, allergies, and the nutritional value of the meal. I usually plan a menu that includes a protein, a carbohydrate, and a variety of vegetables.Step 2: Gathering IngredientsOnce the menu is set, I gather all the necessary ingredients. This might involve a trip to the local market or simply rummaging through the pantry and fridge. Freshness is key, so I opt for fresh produce whenever possible.Step 3: Preparing the IngredientsNext, I prepare the ingredients. This involves washing,peeling, chopping, and measuring out the ingredients. Proper preparation ensures that each component cooks evenly and retains its texture.Step 4: Setting Up the KitchenBefore I start cooking, I make sure my kitchen is set up for success. This includes cleaning the workspace, preheating the oven if needed, and having all my pots and pans ready.Step 5: Cooking the MealWith everything in place, I begin cooking. I follow a recipeor use my knowledge to guide the process. Cooking involves a variety of techniques such as sautéing, boiling, baking, and grilling. I pay close attention to the heat levels andcooking times to ensure the best results.Step 6: SeasoningSeasoning is an art in itself. I add spices and herbs to enhance the flavors of the dish. A little salt and pepper can make a world of difference, and I often taste as I go toadjust the flavors accordingly.Step 7: PlatingOnce the cooking is done, I move on to plating. A well-plated dish can make the meal more visually appealing and appetizing.I consider the colors, textures, and presentation when plating.Step 8: Cleaning UpAfter enjoying the meal, I clean up the kitchen. Thisincludes washing dishes, wiping down surfaces, and puttingaway ingredients and utensils. A clean kitchen is a sign of a well-executed cooking process.Step 9: Reflecting on the ExperienceFinally, I take a moment to reflect on the cooking experience. Did the meal turn out as expected? What could be improved for next time? Reflection helps me to grow as a cook and enjoythe process even more.Cooking is not just about making food; it's about the journey from raw ingredients to a delicious, nourishing meal. It's a process that can be enjoyed by anyone, regardless of theirskill level. So, roll up your sleeves, turn on the stove, and let's cook!This composition provides a clear and structured approach to the process of cooking, from planning to reflection, in English.。
