2

我在我的 .NET Visual Studio 代码中添加了一个服务参考(https://cawc-test.crm.ap2.oraclecloud.com/mklLeads/SalesLeadService?WSDL )。但它不生成app.config文件。我还尝试在 Visual Studio 命令提示符下使用 svcutil.exe。我还尝试通过在添加服务引用时单击“高级”按钮来取消选中“在引用的程序集中重用类型”。但仍然App.config没有生成文件。

client = new SalesLeadServiceClient();
_client.ClientCredentials.UserName.UserName = " ";
_client.ClientCredentials.UserName.Password = " ";

EndpointAddress endPointAddr = new EndpointAddress(address);
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
_client = new SalesLeadServiceClient(binding, endPointAddr);
BindingElementCollection elements = _client.Endpoint.Binding.CreateBindingElements();
elements.Find<SecurityBindingElement>().IncludeTimestamp = false;
_client.Endpoint.Binding = new CustomBinding(elements);
igcomp.PrepareConnectSession(_client.ChannelFactory);

我在课堂上添加了以下代码。但它仍然给出“找不到引用合同的默认端点元素”。

如果有人可以就此提出任何解决方案,将不胜感激?

4

0 回答 0