Azure Web 角色入口点和 .aspx 页面处理程序在不同进程中运行是如何发生的? [英] How does it happen Azure web role entry point and .aspx page handler are run in different processes?

查看:26
本文介绍了Azure Web 角色入口点和 .aspx 页面处理程序在不同进程中运行是如何发生的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 这个 Azure Web 角色示例.它包含一个派生自 RoleEntryPoint 的类和一个包含按钮单击处理程序的 .aspx 页面.

I'm playing with this Azure web role sample. It contains a class derived from RoleEntryPoint and a .aspx page that contains a button click handler.

我在 Azure 模拟器中对其进行了测试.我把下面的代码(取自从这里)

I test it in Azure Emulator. I put the following code (taken from here)

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name;

在角色 OnStart() 和按钮点击处理程序中.当角色 OnStart() 被调用时,它恰好在 MachineName\MyLogin 帐户下的 WaIISHost.exe 中运行,并且当按钮处理程序代码被调用时恰好在 MachineName\NETWORK SERVICE 帐户下的 w3wp.exe 中运行.这很令人惊讶.

in both role OnStart() and the button click handler. When role OnStart() is invoked it happens to run in WaIISHost.exe under MachineName\MyLogin account and when button handler code is invoked it happens to run in w3wp.exe under MachineName\NETWORK SERVICE account. That's surprising.

为什么来自同一个角色项目的这些代码段在不同的进程和不同的帐户下运行?我可以改变吗?

Why are these pieces of code from the same role project run inside different processes and under different accounts? Can I change that?

推荐答案

大卫是对的.除此之外,您可以关闭此行为并在可托管的 Web 核心中运行所有内容(因为它在 SDK 1.4 之前工作).您只需要注释掉服务定义中的站点"部分,如下例所示:

David is correct. In addition to that, you can turn off this behavior and run everything in the hostable web core (as it worked before SDK 1.4). You just need to comment out the "Sites" section in the services definition like in the example below:

<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="aExpense.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition">
  <WebRole name="aExpense" vmsize="Medium">
    <Sites>
      <Site name="Web">
        <Bindings>
          <Binding name="HttpsIn" endpointName="HttpsIn" />
        </Bindings>
      </Site>
    </Sites>
    <ConfigurationSettings>
      <Setting name="DiagnosticsConnectionString" />
      <Setting name="DataConnectionString" />
      <Setting name="allowInsecureRemoteEndpoints" />
    </ConfigurationSettings>

这篇关于Azure Web 角色入口点和 .aspx 页面处理程序在不同进程中运行是如何发生的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆