using System;
using System.Collections;
using System.EnterpriseServices;
using WellDecision.Common;
using WellDecision.Common.ModelDataAccess;
using WellDecision.Common.Model;
using WellDecision.Common.Config;
using WellDecision.Common.Util;namespace WellDecision.ApplicationServer
{
// [SecurityRole("SeismicFetcher",true )] /// <summary>
/// SeismicFetcher 的摘要说明。
/// </summary>
public class SeismicFetcher : ServicedComponent , ISeismic
{
public SeismicFetcher()
{
} #region ISeismic 成员 public byte[] GetInlineSegy(int inline, string filename, string surveyID, string volumeID)
{
//根据surveyID和volumeID得到SegyPath
SeismicVolume volume = SeismicVolumeDA.GetClassByID ( SystemSettings.LocalDBAlias, surveyID, volumeID ); volume.GetInlineSEGY( inline, filename ); return new Byte[0];
}
}
using System.Collections;
using System.EnterpriseServices;
using WellDecision.Common;
using WellDecision.Common.ModelDataAccess;
using WellDecision.Common.Model;
using WellDecision.Common.Config;
using WellDecision.Common.Util;namespace WellDecision.ApplicationServer
{
// [SecurityRole("SeismicFetcher",true )] /// <summary>
/// SeismicFetcher 的摘要说明。
/// </summary>
public class SeismicFetcher : ServicedComponent , ISeismic
{
public SeismicFetcher()
{
} #region ISeismic 成员 public byte[] GetInlineSegy(int inline, string filename, string surveyID, string volumeID)
{
//根据surveyID和volumeID得到SegyPath
SeismicVolume volume = SeismicVolumeDA.GetClassByID ( SystemSettings.LocalDBAlias, surveyID, volumeID ); volume.GetInlineSEGY( inline, filename ); return new Byte[0];
}
}
private void button1_Click(object sender, System.EventArgs e)
{
SeismicFetcher a = new SeismicFetcher();
a.GetInlineSegy( 300,"111.sgy", "00130210026200410201", "1"); this.Close();
}
//将组件设置为服务器启动模式。
[assembly: ApplicationActivation(ActivationOption.Server) ]
程序正常,否则,报错
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;namespace MyWebForm
{
/// <summary>
/// ComPlusExample 的摘要说明。
/// </summary>
public class ComPlusExample : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
} #region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
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)
{
Label1.Text=new cl.ComPlusExample().hello();
}
}
}
using System.EnterpriseServices;
using System.Runtime.CompilerServices;
using System.Reflection;// Supply the COM+ application name.
[assembly: ApplicationName("ComPlusExample")]
// Supply a strong-named assembly.
[assembly: AssemblyKeyFileAttribute("ComPlusExample.snk")]namespace cl
{
[Transaction(TransactionOption.Required)]
public class ComPlusExample : ServicedComponent
{
[AutoComplete]
public string hello()
{
return "com+成功!!!";
}
}
}
如果是ActivationOption.Server,则从“组件服务”中导出一个Proxy包,然后在客户端安装。
com+需要安装到GAC,要有强名称。
gacutil.exe /i ***.dll
首先,你的DLL文件是否加入的强名称,.snk
其次,你的COM+中工程是否使用了用户权限,而且他的权限是否在客户端可以使用,你的程序我没看,太长懒......
你的DLL都实现什么功能??MTS??.........
当客户端启用代理时是会激发服务器端COM+进程,你要看看是否进程已经启动.
还有就是引用方法了,那就是代码问题