将网站发布到 Azure 虚拟机时无法连接 Office 365

Can't connect with Office 365 when publish Website to Azure Virtual Machine

我用 C# 编写了一个连接到 Office 365 并在 Azure 虚拟机中创建用户邮箱的程序。

当我在 Azure 虚拟机(Windows 服务器 2012)或本地 Windows 7 计算机中 运行 我的程序时没问题。用户已创建。我检查了 EAC 和 Powershell。

但是当我将网站(部署到 Azure)发布到我的 Azure 订阅帐户时,我无法创建用户。

我认为连接字符串有问题。但是,如上所述,用户是在本地计算机和Azure虚拟机(Windows server 2012虚拟机)上创建的。

我是否需要对 Azure 进行更多设置才能正确 运行 我的程序?

我找到了解决方案。您需要配置 "Internet information (ISS) Manager"

在虚拟机 Windows Server 2012 中。您打开 "Management tool" --> 打开 "Internet information (ISS) Manager --> Select Your Windows server --> Select sub folder named: Application Pool --> Right click "DefaultAppPopl" --> 选择 "Detail Setting" --> 设置 "Load user profile" 值到 "True"