如何使用只能安装在一个系统上的c#(WCF)在vs2010中创建msi安装程序

本文关键字:安装 程序 WCF vs2010 msi 创建 一个 何使用 系统 | 更新日期: 2023-09-27 18:23:42

我想在vs2010中使用c#(wcf)创建msi安装程序,以便安装程序只能安装在一个系统上(类似于单用户防病毒)。

更具体地,大家好,

            I have a WCF service  (not hosted in IIS) having two functions.

1-

字符串licenseKey=null;

公共字符串getLicenseKey()

    {
         //uses AesCryptoServiceProvider to generate licencekey by encrypting machinename
        licenceKey = licence;
        returnlicence;
    }

它返回licensencekey。

2-

           publicboolvalidateLicenceKey(stringlicKey)
    {

//使用AesCryptoServiceProvider解密许可密钥

        intstatus = String.Compare(decriptKey, machineName);
        if(status == 0)
            returntrue;
        else
            returnfalse;
    }

要求:

1-我希望安装程序调用getLicenseKey()并向用户显示许可密钥。

2-然后它要求用户输入许可证密钥,然后调用validateLicense key()来验证许可证密钥。

3-如果验证成功,则它将被安装,否则未安装,并显示消息"无效许可证密钥"。

有谁能帮我吗?

乙醇

如何使用只能安装在一个系统上的c#(WCF)在vs2010中创建msi安装程序

这是我从您的需求中获得的,您希望在设置中调用Web服务。1.使用WIXhttp://www.wixtoolset.org/创建MSI2.使用WIX的"CustomAction"功能,通过使用c#构建的自定义dll调用web服务。