所以,我导入DLL和我试图使用参数C# - PowerShell的AddPSSnapin导致错误
运行New-Mailbox
命令所以我用:
RunspaceConfiguration config = RunspaceConfiguration.Create();
PSSnapInException psEx = null;
config.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out psEx);
这是所有罚款和花花公子.. 。但是当我去运行应用程序,我得到如下: Cannot load Windows PowerShell snap-in Microsoft.Exchange.Management.PowerShell.E2010 because of the following error: The type initializer for 'Microsoft.Exchange.Data.Directory.Globals' threw an exception.
所以,我做了一些研究网上,我发现我需要改变从Any CPU
到x86
作为平台目标。
然而,当我这样做,我得到一个HTTP Error 503. The service is unavailable.
错误
我几乎可以肯定,我要运行它作为一个32位处理器,因此可以使用该管理单元(从其他阅读似乎是什么管理单元正在运行)
我确实已将应用程序池更改为Enable 32-bit Applications
至True
。当我得到错误时是哪一个。
我已阅读其他帖子......但是,我不知道如何通过这个Service unavailable
事情。
我使用的x64编译尝试并获得Could not load file or assembly 'EmailAdminWeb2' or one of its dependencies. An attempt was made to load a program with an incorrect format.
您是否安装了Exchange 2010外壳管理器? – urlreader
是的。我实际上可以通过运行'add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010'首先从powershell运行任何脚本 – BRogers