程序在我本机上是OK的,但我放到服务器上就出现如下错误,请高手帮忙
这是错误信息如下:
======================================================
带有 CLSID {0002E500-0000-0000-C000-000000000046} 的 COM 对象无效或未注册。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.Runtime.InteropServices.COMException: 带有 CLSID {0002E500-0000-0000-C000-000000000046} 的 COM 对象无效或未注册。源错误: 执行当前 Web 请求期间生成了未处理的异常。可以使用下面的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。  堆栈跟踪: 
[COMException (0x80040154): 带有 CLSID {0002E500-0000-0000-C000-000000000046} 的 COM 对象无效或未注册。]
   BBKStocks.wf_ProductPriceChart.MakeLineChart(String MateriesID) in d:\bbk\bbkc\bbkcb\bbkav\bbkstocks\wf_productpricechart.aspx.cs:63
   BBKStocks.wf_ProductPriceChart.Page_Load(Object sender, EventArgs e) in d:\bbk\bbkc\bbkcb\bbkav\bbkstocks\wf_productpricechart.aspx.cs:34
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731
我的代码如下:
===========================================
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using OWC;namespace BBKStocks
{
/// <summary>
/// wf_ProductPriceChart 的摘要说明。
/// </summary>
public class wf_ProductPriceChart : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
HRService.BBKHRService HRS = new BBKStocks.HRService.BBKHRService();
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.PlaceHolder PlaceHolder1; private void Page_Load(object sender, System.EventArgs e)
{
if(!IsPostBack)
{
DataSet myds = HRS.GetTypeDetails();
this.DropDownList1.DataSource = myds;
this.DropDownList1.DataTextField ="PNAME";
this.DropDownList1.DataValueField="PID";
this.DropDownList1.DataBind(); 
this.MakeLineChart(this.DropDownList1.SelectedValue.ToString());
}

} private void MakeLineChart(string MateriesID)
{
DataSet dsMateries = HRS.GetChartDetails(MateriesID); int[] DayPrice = new int[dsMateries.Tables[0].Rows.Count];
string[] DayName = new string[dsMateries.Tables[0].Rows.Count]; string strDayName = "";
string strDayPrice = ""; for(int i=0;i<dsMateries.Tables[0].Rows.Count;i++)
{
DayPrice[i] = Convert.ToInt16(dsMateries.Tables[0].Rows[i][0]);
DayName[i] = Convert.ToDateTime(dsMateries.Tables[0].Rows[i][1]).ToShortDateString();
} for(int i=0;i<dsMateries.Tables[0].Rows.Count;i++)
{
strDayPrice += DayPrice[i].ToString()+'\t';
strDayName += DayName[i].ToString()+'\t';
}               //PlaceHolder1.Controls.Clear();               OWC.ChartSpace mySpace = new OWC.ChartSpaceClass();
mySpace.Clear();
     OWC.WCChart myChart = mySpace.Charts.Add(0); string strSeriesName = this.DropDownList1.SelectedItem.Text.ToString(); myChart.Type = OWC.ChartChartTypeEnum.chChartTypeSmoothLine;//.chChartTypeLine;
myChart.HasLegend = true;
myChart.HasTitle = true;
myChart.Title.Caption = "步步高视听电子有限公司---采购原材料价格走向图"; myChart.Axes[0].HasTitle = true;
myChart.Axes[0].Title.Caption = "价格(RMB)"; //myChart.Axes[0].Title.Font.Size  = 15;
//myChart.Axes[0].Title.Font.Bold = true;
//myChart.Axes[0].Title.Font.Color = "#ff3300";

//myChart.Axes[0].MajorGridlines.Line.Color = "black";
//myChart.Axes[0].Font.Size = 14;
//myChart.Axes[0].Font.Color = "#ff3300";//X轴刻度颜色
//myChart.Axes[0].Font.Bold = true;
myChart.Axes[0].MajorTickMarks = OWC.ChartTickMarkEnum.chTickMarkAutomatic; myChart.Axes[1].HasTitle = true;
myChart.Axes[1].Title.Caption = "日期";
//myChart.Axes[1].Title.Font.Size  = 15;
//myChart.Axes[1].Title.Font.Bold = true;
//myChart.Axes[1].Title.Font.Color = "#ff3300";
//myChart.Axes[1].Font.Size = 14;
//myChart.Axes[1].Font.Color = "#ff3300";//Y轴刻度颜色
//myChart.Axes[1].Font.Bold = true; myChart.SeriesCollection.Add(0); //曲线图上添加数值
myChart.SeriesCollection.Add(0).DataLabelsCollection.Add().HasValue = true; myChart.SeriesCollection[0].Marker.Style=OWC.ChartMarkerStyleEnum.chMarkerStyleSquare;
myChart.SeriesCollection[0].Line.set_Weight(OWC.LineWeightEnum.owcLineWeightHairline); myChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimSeriesNames,(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral,strSeriesName);
myChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimCategories,(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral,strDayName);
myChart.SeriesCollection[0].SetData(OWC.ChartDimensionsEnum.chDimValues,(int)OWC.ChartSpecialDataSourcesEnum.chDataLiteral,strDayPrice);

string Name = System.DateTime.Now.Millisecond.ToString();
string strAbsolutePath = (Server.MapPath("."))+@"\images\"+Name+".gif";
string Path = (Server.MapPath("."))+@"\images\";
foreach (string file in System.IO.Directory.GetFiles(Path))
{
System.IO.File.Delete(file);
}
mySpace.ExportPicture(strAbsolutePath,"GIF",900,400); string strRelativePath = "../BBKStocks/images/"+Name+".gif";
string strImageTag = "<IMG SRC='"+ strRelativePath +"'/>"; this.PlaceHolder1.Controls.Add(new LiteralControl(strImageTag));
               this.PlaceHolder1.Dispose(); //释放内存
   } #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{

} private void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string MateriesID = this.DropDownList1.SelectedValue.ToString();
this.MakeLineChart(MateriesID);
//Response.Redirect("wf_ProductPriceChart.aspx");

}
}
}
 

解决方案 »

  1.   

    需要用到一个传统的Com控件。使用Regsvr32导入该控件即可
      

  2.   

    kssys这位兄弟,具体怎么做呀,我还以为服务器没有装Office的问题,后来装了还是出现这样的问题,真是怪,在本机行,到服务器就不行,各位高人,能否给出具体的解决方法呀,万分感谢~~
      

  3.   

    你用到了owc,把你的owc重新安装一下应该就可以了
      

  4.   

    这里面使用了OWC1)如果有安装程序,直接安装相应程序。
    2)如果是DLL,那么使用Regsvr32导入,方法:
    双击DLL->打开->选择程序->浏览->C:\Windows\System32\Regsvr32.exe->确定即可。
      

  5.   

    我已在服务器上装了OFFICE,而以也重新注册了,但还是出现那样的错误呀
    现在急死了,还有没有什么地方要操作的呀,Kssys兄弟那种操作是在98下才那样的吧
      

  6.   

    楼主参看:http://topic.csdn.net/t/20050118/14/3734761.html
      

  7.   

    问题已解决,解决方法为:
    1、先在服务器上装OFFICE2000软件(也可以不装),但要有msowc.dll;
    2、将msowc.dll文件拷到WINNT/system32/下面;
    3、注册msowc.dll控件,如果是OWC9的话,regsvr32 -s msowc.dll 注册一下.谢谢各位的关注.............