首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SP 2007 -无法显示Webpart

SP 2007 -无法显示Webpart
EN

Stack Overflow用户
提问于 2011-10-25 17:14:10
回答 2查看 580关注 0票数 0

错误:“无法显示或导入此页面上的not部件。无法找到该类型或未将其注册为安全”

试图在源代码中查找此错误的详细信息,但不太确定问题的确切位置。

有关以前执行的修补程序,请参阅This Thread

有什么好的开始位置的指示吗?

DLL: TCBOE.ChartPart.dll

名称空间: TCBOE.Chartpart

FeatureReceiver.vb

代码语言:javascript
复制
Private Shared Sub AddOrRemoveChartHandlerToWebConfig(ByVal web As SPWebApplication, ByVal remove As Boolean)
    Dim asm As String = String.Format(CultureInfo.InvariantCulture, _
      "System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version={0}, Culture=neutral, PublicKeyToken={1}", _
      New Object() {"3.5.0.0", "31bf3856ad364e35"})
    Dim modif As New SPWebConfigModification("add[@path='ChartImg.axd']", _
      "configuration/system.web/httpHandlers")
    modif.Owner = "TCBOE.ChartPart"
    modif.Sequence = 0
    modif.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode

    modif.Value = String.Format(CultureInfo.InvariantCulture, _
      "<add verb=""{0}"" path=""{1}"" type=""{2}"" validate=""{3}"" />", _
      New Object() {"GET,HEAD,POST", "ChartImg.axd", asm, "false"})
    If (remove) Then
        web.WebConfigModifications.Remove(modif)
    Else
        web.WebConfigModifications.Add(modif)
    End If

End Sub
Private Shared Sub AddOrRemoveChartSettingsToWebConfig(ByVal web As SPWebApplication, ByVal remove As Boolean)
    Dim appSettings As New SPWebConfigModification("appSettings", "configuration")
    appSettings.Owner = "TCBOE.ChartPart"
    appSettings.Sequence = 0
    web.WebConfigModifications.Add(appSettings)

    Dim keyVal As String = String.Format(CultureInfo.InvariantCulture, _
     "storage={0};timeout={1};", _
     New Object() {"memory", "20"})
    Dim modif As New SPWebConfigModification("add[@key='ChartImageHandler']", "configuration/appSettings")
    modif.Owner = "TCBOE.ChartPart"
    modif.Sequence = 1
    modif.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode

    modif.Value = String.Format(CultureInfo.InvariantCulture, _
      "<add key=""{0}"" value=""{1}"" />", _
      New Object() {"ChartImageHandler", keyVal})
    If remove Then
        web.WebConfigModifications.Remove(modif)
    Else
        web.WebConfigModifications.Add(modif)
    End If
End Sub
<SharePointPermission(System.Security.Permissions.SecurityAction.Demand, ObjectModel:=True)> _
Public Overrides Sub FeatureActivated(ByVal properties As Microsoft.SharePoint.SPFeatureReceiverProperties)
    Dim site As SPSite = TryCast(properties.Feature.Parent, SPSite)
    Dim web As SPWebApplication = site.WebApplication
    AddOrRemoveChartSettingsToWebConfig(web, False)
    AddOrRemoveChartHandlerToWebConfig(web, False)
    web.Farm.Services.GetValue(Of SPWebService)().ApplyWebConfigModifications()
    web.Update()
End Sub
<SharePointPermission(System.Security.Permissions.SecurityAction.Demand, ObjectModel:=True)> _
Public Overrides Sub FeatureDeactivating(ByVal properties As Microsoft.SharePoint.SPFeatureReceiverProperties)
    Dim site As SPSite = TryCast(properties.Feature.Parent, SPSite)
    Dim web As SPWebApplication = site.WebApplication
    AddOrRemoveChartSettingsToWebConfig(web, True)
    AddOrRemoveChartHandlerToWebConfig(web, True)
    web.Farm.Services.GetValue(Of SPWebService)().ApplyWebConfigModifications()
    web.Update()
End Sub

加:2011年10月26日@11:36

Manifest.xml

(由WSPBuilder创建)

代码语言:javascript
复制
<?xml version="1.0"?>
<!-- Solution created by WSPBuilder. 10/26/2011 8:19:40 AM  -->
<Solution SolutionId="ee03c5c2-c9bd-4cfe-ac16-225f8e28072b" xmlns="http://schemas.microsoft.com/sharepoint/">
  <Assemblies>
    <Assembly Location="cablib.dll" DeploymentTarget="GlobalAssemblyCache" />
    <Assembly Location="TCBOE.ChartPart.dll" DeploymentTarget="GlobalAssemblyCache">
      <SafeControls>
        <SafeControl Assembly="TCBOE.ChartPart, Version=3.5.1.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" Namespace="TCBOE.ChartPart" TypeName="*" Safe="True" />
      </SafeControls>
    </Assembly>
  </Assemblies>
  <TemplateFiles>
    <TemplateFile Location="IMAGES\ChartPartWP\oscillator_16.gif" />
    <TemplateFile Location="IMAGES\ChartPartWP\oscillator_32.gif" />
  </TemplateFiles>
  <FeatureManifests>
    <FeatureManifest Location="ChartPartWP\feature.xml" />
  </FeatureManifests>
</Solution>

是否有CAS策略限制本地机器用户帐户(用于运行服务)会导致这种行为的情况?

2011年3月11日编辑:

Ok终于得到了一个“伟大的实践”安装,它是稳定的和工作的。获得了原来的控制,我正在定制加载和工作,因为它应该。

去“安装”我编辑的控件,并在尝试部署解决方案时收到此错误响应:

代码语言:javascript
复制
Feature '47d62f5e-b0e0-4f93-bcd1-081ca794527c' could not be installed because the loading of event receiver assembly "TCBOE.ChartPart, Verstion=3.5.1.0, Culture=neutral, PublicKeyToken=9f4da00116c38ec5" failed: System.IO.FileNotFoundException: Could not load file or assembly 'TCBOE.ChartPart, Culture=neutral, PublicKeyToken=9f4da00116c38ec5' or one of its dependencies. The system cannot find the file specified. 
File name: 'TCBOE.ChartPart, Culture=neutral, PublicKeyToken=9f4da00116c38ec5' 
   at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) 
   at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
   at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) 
   at System.Reflection.Assembly.Load(String assemblyString) 
   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject() 

WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
EN

回答 2

Stack Overflow用户

发布于 2011-10-25 17:27:01

web部件应该在web.config的SafeControls中注册。做起来很简单。尝试以下链接:

http://msdn.microsoft.com/en-us/library/ms581321(v=office.12).aspx

票数 1
EN

Stack Overflow用户

发布于 2011-10-27 14:26:25

您是否使用用户控件来呈现the部件?如果是这样的话,将其放在UserControl的顶部:

代码语言:javascript
复制
<%@ Assembly Name="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>

如果不使用UserControl,只需修改代码将该行添加到标记中的web.config中:

代码语言:javascript
复制
<add assembly="System.Web.DataVisualization, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

我在另一条线上告诉过你,你在用超硬的方式尝试用手摆弄这些东西。如果您使用的是SmartPart或VSeWSS 1.3,您将而不是进行所有这些操作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7893145

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档