1. 症状
您的SharePoint 2010的服务器是不是最近一直出现这个错误呢?
Could not load file or assembly 'Microsoft.Office.InfoPath, Version=14.0.0.0' (...)
特别是当我们部署新的InfoPath解决方案时,我们突然之间发现,无法把模板上传到服务器当中去了,但是我们发现在GAC中,这个Microsoft.Office.InfoPath.dll 是存在的
问题出在哪里?
2.分析过程
在日志中有这么一句话:
System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.Office.InfoPath, Version=14.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system
cannot find the file specified.
根据前文分析,文件是一定存在的,但为什么呢,我们继续打开编译日志文件
报告如下:
*** Assembly Binder Log Entry (4/12/2012 @ 12:51:23) ***
The operation failed.
Bind result: hr = 0x80131040. No description available.
Assembly manager loaded from: C:WindowsMicrosoft.NETFramework64v2.0.50727mscorwks.dll
Running under executable c:windowssystem32inetsrvw3wp.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = WINDEVSP2010SPInstaller
LOG: DisplayName = Microsoft.Office.InfoPath, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
(Fully-specified)
LOG: Appbase = file:///C:/inetpub/wwwroot/wss/VirtualDirectories/80741441fc-0d39-48f0-954e-96614c358095/
LOG: Initial PrivatePath = C:inetpubwwwrootwssVirtualDirectories80741441fc-0d39-48f0-954e-96614c358095in
LOG: Dynamic Base = C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Files
ootef3f51d0
LOG: Cache Base = C:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Files
ootef3f51d0
LOG: AppName = a6d35fbc
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file:
C:inetpubwwwrootwssVirtualDirectories80741441fc-0d39-48f0-954e-96614c358095web.config
LOG: Using host configuration file: C:WindowsMicrosoft.NETFramework64v2.0.50727Aspnet.config
LOG: Using machine configuration file from C:WindowsMicrosoft.NETFramework64v2.0.50727configmachine.config.
LOG: Publisher policy file is found at
C:WindowsassemblyGAC_MSILPolicy.14.0.Microsoft.Office.InfoPath15.0.0.0__71e9bce111e9429cPolicy.14.0.Microsoft.Office.InfoPath.config.
LOG: Publisher policy file redirect is found: 14.0.0.0 redirected to 15.0.0.0.
LOG: ProcessorArchitecture is locked to MSIL.
LOG: Post-policy reference: Microsoft.Office.InfoPath, Version=15.0.0.0,
Culture=neutral, PublicKeyToken=71e9bce111e9429c,
processorArchitecture=MSIL
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary
ASP.NET Files/root/ef3f51d0/a6d35fbc/Microsoft.Office.InfoPath.DLL.
LOG: Attempting download of new URL
file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary
ASP.NET
Files/root/ef3f51d0/a6d35fbc/Microsoft.Office.InfoPath/Microsoft.Office.InfoPath.DLL.
LOG: Attempting download of new URL
file:///C:/inetpub/wwwroot/wss/VirtualDirectories/80741441fc-0d39-48f0-954e-96614c358095/bin/Microsoft.Office.InfoPath.DLL.
LOG: Assembly download was successful. Attempting setup of file:
C:inetpubwwwrootwssVirtualDirectories80741441fc-0d39-48f0-954e-96614c358095inMicrosoft.Office.InfoPath.dll
LOG: Entering download cache setup phase.
LOG: Assembly Name is: Microsoft.Office.InfoPath, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: The assembly reference did not match the assembly definition found.
ERR: Setup failed with hr = 0x80131040.
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
现在我们找到原因了!好像是GAC的某个设置把14.00重定向到15.000,但是这个DLL又不支持SharePoint 2010,呵呵。
我们在运行当中打开如下的目录:
C:WindowsassemblyGAC_MSIL
我发现如下的文件夹:Policy.14.0.Microsoft.Office.InfoPath 有一个子文件夹 “15.0.0.0__71e9bce111e9429c”.
我继续查看web.config文件中的设置,设置中有这么一段:
<?xml version="1.0" encoding="UTF-16"?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity publicKeyToken="71e9bce111e9429c" name="Microsoft.Office.InfoPath" culture="neutral"></assemblyIdentity> <bindingRedirect oldVersion="14.0.0.0" newVersion="15.0.0.0"></bindingRedirect> </dependentAssembly> </assemblyBinding> </runtime> </configuration>
哈哈找到问题了!
3.解决方案
1. 打开“开始-运行” ,输入: C:WindowsAssemblyGAC_MSIL
2.删除掉如下的文件夹:
Policy.14.0.Microsoft.Office.InfoPath
Policy.14.0.Microsoft.Office.InfoPath.Client.Internal.Host
Policy.14.0.Microsoft.Office.InfoPath.FormControl
3. 运行“ IISRESET /noforce” 重启IIS
哈哈哈,终于可以继续我的InfoPath的部署和开发拉!