简体   繁体   English

WCF 安装程序 class - 找不到引用合同的默认端点元素

[英]WCF installer class - Could not find default endpoint element that references contract

i've got installer class in client project我在客户端项目中有安装程序 class

public override void Install(IDictionary stateSaver)
{
    base.Install(stateSaver);
        using (ServiceReference1.ClientClient client = new ServiceReference1.ClientClient())
        {
            if (!client.Register(Context.Parameters["firstname"], Context.Parameters["lastname"], Context.Parameters["email"], Context.Parameters["password"]))
            {
              throw new InstallException("Email address is already used");
            }
        }
}

Result: Could not find default endpoint element that references contract 'ServiceReference1.IClient' in the ServiceModel client configuration section.结果:在 ServiceModel 客户端配置部分找不到引用协定“ServiceReference1.IClient”的默认终结点元素。 This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.这可能是因为没有找到您的应用程序的配置文件,或者因为在客户端元素中找不到匹配此协定的端点元素。

Any ideas to fix it?有什么想法可以解决吗?

WCF looks for a YourInstallerAssemblyName.EXE .config file for configuring the WCF client (Service Reference) your installer code is using. WCF 查找YourInstallerAssemblyName.EXE .config 文件,用于配置安装程序代码正在使用的 WCF 客户端(服务参考)。 The file needs to contain the serviceModel element from the app/web.config file where you create the Service Reference.该文件需要包含您在其中创建服务引用的 app/web.config 文件中的serviceModel元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM