After upgrading the ebPart Assembly "Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed .."
2009-04-23 18:07
441 查看
我们项目开发了一些webpart, 客户要求以后升级版本后,以前的webpart也应该能用。
我们试验发现,一旦assembly版本发生变化后,以前的webpart都会报这么一个错误:
Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.
Show Error Details
Hide Error Details
[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
后来经过调查,发现按照下列步骤可以解决这个问题。
1. 首先修改web.config中webpart对应的safecontrol配置部分,将版本修改到旧的版本号。
2. 在<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
节点处添加一个新的bindingRedirect项目。如下:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
3. 此时你再访问你的webpart页面,这些webpart应该都已经可以正常访问了。
4. 最后是一个奇怪的现象,一旦你正常访问这些webpart后,你再撤销刚才那些对web.config的修改也没有什么问题了。不过个人认为还是不删除的好。
我们试验发现,一旦assembly版本发生变化后,以前的webpart都会报这么一个错误:
Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.
Show Error Details
Hide Error Details
[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)
后来经过调查,发现按照下列步骤可以解决这个问题。
1. 首先修改web.config中webpart对应的safecontrol配置部分,将版本修改到旧的版本号。
2. 在<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
节点处添加一个新的bindingRedirect项目。如下:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="myAssembly"
publicKeyToken="32ab4ba45e0a69a1"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0"
newVersion="2.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
3. 此时你再访问你的webpart页面,这些webpart应该都已经可以正常访问了。
4. 最后是一个奇怪的现象,一旦你正常访问这些webpart后,你再撤销刚才那些对web.config的修改也没有什么问题了。不过个人认为还是不删除的好。
相关文章推荐
- maven使用jstl表达式和The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application解决
- SQL Server 2008 : Invoke or BeginInvoke cannot be called on a control until the window handle has ..
- This absolute uri http://Java.sun.com/jsp/jstl/core) cannot be resolved in either web.xml or the jar
- cannot be resolved in either web.xml or the jar files deployed with this application
- 异常:The absolute uri: http://www.springframework.org/security/tags cannot be resolved in either web.xml or the jar files deployed with this application
- jeesite部署到Tomcat后,无法访问,cannot be resolved in either web.xml or the jar files deployed with this application
- HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
- This absolute uri http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
- Visual studio cannot create or open the application because the Web server on this computer is...
- MSSQL: Invoke or BeginInvoke cannot be called on a control until the window handle has been created.
- Openning SharePoint - 80 website gives HTTP 404 Error, The webpage cannot be found ! on SharePoint 2013
- The absolute uri: http://struts.apache.org/tags-bean cannot be resolved in either web.xml or the jar files deployed with this application
- The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application的解决办法
- This InfoPath form template is browser-compatible, but it cannot be browser-enabled on the selected site
- HTTP Error 404.2 - Not Found The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server(转)
- The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the ser
- IIS Error:404.2 The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the Web server
- This absolute uri http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar
- exception http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
- HTTP Status 500 - The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application