Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Wcf “;找不到引用约定的默认终结点元素”;_Wcf_Error Handling_Endpoint - Fatal编程技术网

Wcf “;找不到引用约定的默认终结点元素”;

Wcf “;找不到引用约定的默认终结点元素”;,wcf,error-handling,endpoint,Wcf,Error Handling,Endpoint,在卸载windows应用程序期间调用webservice时,我收到如下错误: 找不到引用协定的终结点元素 ServiceModel客户端配置中的ServiceReference2.IService1 节。这可能是因为找不到的配置文件 您的应用程序,或者因为没有与此名称匹配的端点元素 可以在客户端元素中找到 我正在使用Installer类,在该类中调用webservice客户端。以下是installer.cs的代码 源代码: namespace webMiner { [RunInstal

在卸载windows应用程序期间调用webservice时,我收到如下错误:

找不到引用协定的终结点元素 ServiceModel客户端配置中的ServiceReference2.IService1 节。这可能是因为找不到的配置文件 您的应用程序,或者因为没有与此名称匹配的端点元素 可以在客户端元素中找到

我正在使用Installer类,在该类中调用webservice客户端。以下是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()将调用包含帐户更新的webservice操作

如何解决这个问题? 真的对这个问题感到厌倦了吗

当我从另一个页面或另一个类文件调用serviceclient时,我没有问题。当我在卸载应用程序(即在Installer类中)时调用serviceclient时,它会给我带来问题。这是我使用的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文件中???

尝试更新服务引用,并检查启动项目配置文件中是否包含客户端配置。

在安装Service1Client时,您可能需要使用端点的名称

var sc = new webMiner.ServiceReference2.Service1Client("BasicHttpBinding_IService1");

或者,就像我的例子一样,在解决方案中的另一个项目中有另一个类和两个app.config类。因此,您需要在main app.config中复制/粘贴描述点和绑定。

是否需要在web service的web.config文件中添加上面给出的客户机代码??尝试更新服务引用,客户机配置仅在启动项目配置文件中,但没有用OK,这对我有效,但这不可能是正确的解决方案。一定有更好的做法。