C# inproc和outproc的区别

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17817639/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-10 10:33:36  来源:igfitidea点击:

Difference between inproc and outproc

c#inproc

提问by manjuvreddy

I am trying to find difference between inproc and outproc in c#. If I have a dll running on the server and my question is will it run in both inproc and outproc? Performance-wise which process is better?

我试图在 c# 中找到 inproc 和 outproc 之间的区别。如果我在服务器上运行一个 dll,我的问题是它会在 inproc 和 outproc 中运行吗?性能方面哪个过程更好?

采纳答案by tzerb

An inproc server runs in the same process as the calling application. It's close to a normal function call on a dll. Calling an outproc server, data needs to be marshalled across the process boundry which is an expensive operation. An inproc server is fast but it can bring down your application.

inproc 服务器与调用应用程序在同一进程中运行。它接近于对 dll 的正常函数调用。调用 outproc 服务器,数据需要跨进程边界进行编组,这是一项昂贵的操作。inproc 服务器速度很快,但它可能会导致您的应用程序崩溃。

回答by Ehsan

From MSDN

来自MSDN

ASP.NET session state supports several different storage options for session data. Each option is identified by a value in the SessionStateMode enumeration. The following list describes the available session state modes:

ASP.NET 会话状态支持会话数据的几种不同存储选项。每个选项都由 SessionStateMode 枚举中的一个值标识。以下列表描述了可用的会话状态模式:

InProc mode, which stores session state in memory on the Web server. This is the default.

InProc 模式,将会话状态存储在 Web 服务器的内存中。这是默认设置。

StateServer mode/OutProc, which stores session state in a separate process called the ASP.NET state service. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

StateServer 模式/OutProc,它将会话状态存储在称为 ASP.NET 状态服务的单独进程中。这可确保在 Web 应用程序重新启动时保留会话状态,并使 Web 场中的多个 Web 服务器可以使用会话状态。

SQLServer modestores session state in a SQL Server database. This ensures that session state is preserved if the Web application is restarted and also makes session state available to multiple Web servers in a Web farm.

SQLServer 模式将会话状态存储在 SQL Server 数据库中。这可确保在 Web 应用程序重新启动时保留会话状态,并使 Web 场中的多个 Web 服务器可以使用会话状态。

Custom mode, which enables you to specify a custom storage provider. Off mode, which disables session state.

自定义模式,它使您能够指定自定义存储提供程序。关闭模式,禁用会话状态。