有个什么工具吧。可以把com转换成net的组件偶忘记叫什么名字了。
解决方案 »
- 如何判断一个datatable表中,某个字段的类型是不是字符型呢?
- 安装部署
- 连接数据库
- 求助 一个FORM问题
- 请教高数的相关知识
- 问一个问题,请问大家谁知道怎么取一个数据表的字段的全部属性?
- c#绘椭圆
- 我delete一行后,还没有 accept(),myDs.Tables(0).rows.count不变,然后datagrid.databind(),发现datagrid的总行数居然少1了??why?
- 怎麼向 VS2005 IDE 裡安裝的插件, Reflector.FileDisassember
- 提一个可能是很低级的问题,关于同时访问!
- Usenet中文.net新闻组,大家一起上啊
- 谁能详细介绍一下这几个东东 BeginAccept AsyncCallback IAsyncResult
ms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpconwritingservicedcomponents.htm
示例:
BankComponent 服务器[Visual Basic]
Imports System.EnterpriseServices
Imports System.Runtime.CompilerServices
Imports System.Reflection' Supply the COM+ application name.
<assembly: ApplicationName("BankComponent")>
' Supply a strong-named assembly.
<assembly: AssemblyKeyFileAttribute("BankComponent.snk")>Namespace BankComponent
<Transaction(TransactionOption.Required)> _
Public Class Account
Inherits ServicedComponent
<AutoComplete()> _
Public Sub Post(accountNum As Integer, amount As Double)
' Updates the database; no need to call SetComplete.
' Calls SetComplete automatically if no exception is generated.
End Sub
End Class
End Namespace
[C#]
using System.EnterpriseServices;
using System.Runtime.CompilerServices;
using System.Reflection;// Supply the COM+ application name.
[assembly: ApplicationName("BankComponent")]
// Supply a strong-named assembly.
[assembly: AssemblyKeyFileAttribute("BankComponent.snk")]namespace BankComponent
{
[Transaction(TransactionOption.Required)]
public class Account : ServicedComponent
{
[AutoComplete]
public bool Post(int accountNum, double amount)
{
/* Updates the database; no need to call SetComplete.
Calls SetComplete automatically if no exception is
generated. */
return false;
}
}
}
BankComponent 客户端[Visual Basic]
Imports BankComponent
Public Class Client
Shared Sub Main()
Dim Account As New Account()
' Post money into the account.
Account.Post(5, 100)
End Sub
End Class
[C#]
using BankComponent;
namespace BankComponentConsoleClient
{
class Client
{
public static int Main()
{
Account act = new Account();
// Post money into the account.
act.Post(5, 100);
return 0;
}
}
}
由可执行文件宿主承载的应用程序的配置文件与该应用程序位于同一目录。配置文件的名称是带有 .config 扩展名的该应用程序的名称。例如,名为 myApp.exe 的应用程序可以与名为 myApp.exe.config 的配置文件关联。 ASP.NET 承载的应用程序。
ASP.NET 配置文件叫做 Web.config。ASP.NET 应用程序中的配置文件继承该 URL 路径中的配置文件的设置。例如,假设有 URL www.microsoft.com/aaa/bbb,其中 www.microsoft.com/aaa 是 Web 应用程序,与该应用程序关联的配置文件位于 www.microsoft.com/aaa。位于子目录 /bbb 中的 ASP.NET 页,既使用应用程序级的配置文件的设置,又使用位于 /bbb 中的配置文件的设置。 有关 ASP.NET 配置文件的更多信息,请参阅 ASP.NET 配置 Internet Explorer 承载的应用程序。
如果 Internet Explorer 承载的应用程序有配置文件,那么该文件的位置在 <link> 标记中指定,其语法如下: <link rel="ConfigurationFileName" href="location"> 在该标记中,location 是指向该配置文件的 URL。它设置了应用程序基。配置文件必须位于与应用程序所在的同一 Web 站点中。 请你好好看看MSDN:
ms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpconconfiguringnetframeworkapplications.htm
谁说"Soapsuds 都需要建立web service",还是请你好好看看MSDN:
ms-help://MS.VSCC/MS.MSDNVS.2052/cptools/html/cpgrfsoapsudsutilitysoapsudsexe.htm
通过 System.Reflection.Assembly.LoadFrom 可以得到一个 System.Reflection.Assembly的object A ,再通过该GetType() ,可以得到某个Class 的 type ,然后调用A的CreateInstance方法创建对象
string DllName = "x.dll";
string ClassName = "MySample.Test";System.Reflection.Assembly dllFile
try
{
dllFile = System.Reflection.Assembly.LoadFrom(DllName);
}
catch(System.IO.FileNotFoundException ec)
{
return false;
}
System.Type theType = dllFile.GetType(ClassName);
if(theType != null)
{
System.Object obj = dllFile.CreateInstance(theType.FullName);
}
else
{
return false;
}
在客户端引用那个封装的dll
第二步:Add Reference,点击 COM 标签,在列表框找到你注册的 DLL 的标题,确定。
To FJGoodGood(_FJ_强中强):可能是我初学.NET的原因,我不知道怎样使用regsvr32 -i来注册我的dll,如果我使用regsvr32来注册,它会提示我找不到DllRegisterServer入口,而我发现只能使用regsvcs来注册我的dll,这样注册后在组件服务管理器里能看到我的组件,但现在如果要加入组件的引用则会出现我前面说的问题。
我的方法是这样的(不一定是正确的,但可以使用):不注册组件,直接在Add Reference对话框中,使用Browse功能,然后选中我的那个dll,这样就可以了。