在卸载 Windows 应用程序期间调用 webservice 时出现错误
在 ServiceModel 客户端配置部分中找不到引用合同 ServiceReference2.IService1' 的端点元素。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此名称匹配的端点元素。
我正在使用我正在调用 web 服务客户端的安装程序类。以下是installer.cs的代码
源代码 :
namespace webMiner
{
[RunInstaller(true)]
public partial class demoInstaller : Installer
{
SqlConnection conn = new SqlConnection("Data Source=servername;Initial Catalog=comp;User Id=abc;Password=******;");
public demoInstaller():base()
{
InitializeComponent();
AfterUninstall += new InstallEventHandler(AfterUninstallEventHandler);
}
public override void Uninstall(System.Collections.IDictionary savedState)
{
base.Uninstall(savedState);
Int32 flag = -1;
string keyName = "";
RegistryKey regeditkey = Registry.CurrentUser.OpenSubKey("sevenuser", RegistryKeyPermissionCheck.ReadWriteSubTree);
keyName = regeditkey.GetValue("currentuser").ToString();
webMiner.ServiceReference2.Service1Client sc = new webMiner.ServiceReference2.Service1Client();
flag = sc.unInstallOperation(keyName);
}
}
}
其中 unInstallOperation() 将调用包含更新帐户的 web 服务操作。
如何解决这个问题?真的厌倦了这个问题
当我从另一个页面或另一个类文件调用 serviceclient 时,我没有问题,当我在卸载应用程序(即在 Installer 类中)调用时,它会给我带来问题。这是我使用过的 app.config 客户端配置代码
源代码:
<client>
<endpoint address="http://companyfind.info/RegWcfService/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService1"
contract="IService1" name="BasicHttpBinding_IService1" />
</client>
是否需要在 web 服务的 web.config 文件中添加这个?