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

查看:154
本文介绍了它是如何发生的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的模拟器进行测试。我把下面的code(拍摄<一个href=\"http://stackoverflow.com/questions/1240373/how-to-get-current-username-in-net-using-c/1240379#1240379\">from这里)

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

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

在这两个角色的OnStart()键,按一下按钮处理程序。当角色的OnStart()被调用它发生在 WaIISHost.exe 运行在计算机名\\ \\ MyLogin 帐户,当按钮处理code调用它发生在的w3wp.exe 运行在计算机名\\ \\ NETWORK SERVICE 帐户。这是令人惊讶的。

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.

为什么code的这些作品从不同的进程内部,不同的帐户下运行同样的作用的项目?是否可以更改?

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

推荐答案

大卫是正确的。除此之外,你可以关闭此行为,并运行在主存的网络核心的一切(因为它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天全站免登陆