Visual Studio 2012上的Exchange 2010应用程序(.NET 4.0):无法加载Exchange PowerShell管理单元:“Microsoft.Exchange.Data。*”的类型初始值设定项引发异常 [英] Exchange 2010 application on Visual Studio 2012 (.NET 4.0): Cannot load Exchange powershell snap-in: The type initializer for 'Microsoft.Exchange.Data.*' threw an exception

查看:152
本文介绍了Visual Studio 2012上的Exchange 2010应用程序(.NET 4.0):无法加载Exchange PowerShell管理单元:“Microsoft.Exchange.Data。*”的类型初始值设定项引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b
$ b我最近将我的应用程序从.NET framework 2.0升级到4.0。升级后我遇到了一个奇怪的问题。我无法加载Microsoft Exchange程序集。 

Hi

I have recently upgraded my application from .NET framework 2.0 to 4.0. I am facing a strange problem after upgrade. I am unable to load Microsoft Exchange Assemblies. 

 rc = RunspaceConfiguration.Create();
                warning = null;
                if (Version == "2010")
                    info = rc.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.E2010", out warning);

我无法理解问题的原因。但是参考了  这篇
文章
,我得出的结论是,这是一个错误。请建议灵魂。 

提前致谢

I am unable to understand the cause of the problem. But with reference to the this article, I have concluded that this is a bug. Please suggest the soultion. 
Thanks in advance

Rizwan Ahmed。软件工程师 - Microsoft Lync |交换| SharePoint |黑莓企业服务器| .NET

Rizwan Ahmed. Software Engineer - Microsoft Lync | Exchange | SharePoint | Blackberry Enterprise Server | .NET

推荐答案

您好,

您不应该将dotnet 4.0用于项目Exchange 2013/2010/2007组件(特别是PowerShell插件不与.net 4一起使用)。

You should not use the dotnet 4.0 for a projet with Exchange 2013/2010/2007 component (specialy for the powershell addons not working with .net 4).

如下所示,支持版本不包括Exchange 2007上高于3.5的版本

As you can see below the supported version are not including version higher than 3.5 on Exchange 2007

.NET Framework 2.0 SP1

.NET Framework 2.0 SP1

 

 

X

.NET Framework 3.0

.NET Framework 3.0

 

 

X

.NET Framework 3.5

.NET Framework 3.5

 

X 2

X 1

.NET Framework 3.5 SP1

.NET Framework 3.5 SP1

 

X

X

.NET Framework 4.0

.NET Framework 4.0

 

X 2,3

 

.NET Framework 4.5

.NET Framework 4.5

X

X 2,3

 

。 .NET Framework 4.5.1

.NET Framework 4.5.1

X

 

 

.NET Framework 4.5.2

.NET Framework 4.5.2

X

 

 

来源:https://technet.microsoft.com/en-us/library/ff728623%28v=exchg.150%29.aspx

Source : https://technet.microsoft.com/en-us/library/ff728623%28v=exchg.150%29.aspx

你可以使用远程PowerShell以不同的方式在.NET 4.0中对您的应用程序进行编码并导入远程PSSession(在线交换时用于远程PowerShell的相同过程)。

You could code your application in a different way for doing this in .NET 4.0 using remote powershell and import the remote PSSession (same procedure used for remote powershell on exchange online).


Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://exchangeserverfqdn.local/powershell/ -Credential
Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://exchangeserverfqdn.local/powershell/ -Credential


UserCredential -Authentication Basic -AllowRedirection
UserCredential -Authentication Basic -AllowRedirection

创建一个连接到Exchange服务器并调用它应该工作的远程pssession的类,并将cmdlet调整为正确的交换版本(应该适用于EX7 / 10/13)更高的ersion)。

Create a class that connect to the exchange server and invoke a remote pssession it should be working and adapt the cmdlet to the correct exchange version (should work for EX7/10/13 and higher version).

玩得开心:)


这篇关于Visual Studio 2012上的Exchange 2010应用程序(.NET 4.0):无法加载Exchange PowerShell管理单元:“Microsoft.Exchange.Data。*”的类型初始值设定项引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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