设置ClientCredentials:让"用户名不提供"错误 [英] Setting ClientCredentials: getting "Username is not provided" error
问题描述
我任务是从本地WSDL文件创建一个WCF服务。我做了一些R&安培; D于这项任务。我已经加入了当地的WSDL文件的Web引用。现在我想,以获得创建此服务的客户端服务。
I'm tasked with creating a WCF service from a local wsdl file. I have done some R&D on this task. I have added a web reference of that local wsdl file. Now I want to create a client for this service in order access the service.
我如何提供客户端的用户名和密码?
How do I provide the username and password in the client?
目前,当我访问服务在客户端的方法我得到一个错误:
Currently, when I am accessing the service methods in the client I get an error:
不提供用户名
下面是相关的代码:
ServiceGetProductFeeds.ProductFeedServiceClient SerProdFeeds = new ServiceGetProductFeeds.ProductFeedServiceClient();
SerProdFeeds.ClientCredentials.UserName.UserName = "XXXXXX";
SerProdFeeds.ClientCredentials.UserName.Password = "*******";
SerProdFeeds.getProductFeed();
什么是与上面的代码不正确任何提示?
Any tips on what's not correct with the above code?
推荐答案
你有没有安全模式,clientCredentialtype在适当的配置文件来配置?这里是你的问题非常密切匹配的博客文章。我希望这有帮助!
Do you have security mode, clientCredentialtype configured appropriately in your configuration files? Here is a blog post that very closely matches your question. I hope this helps!
的 http://amadotech.blogspot.com/2009/11/error-username-is-not-provided-specify.html
其实有很三大原因与我的应用程序:
Actually there're three causes with my application:
- 安全模式是不appropriae。
- 客户端凭据类型是不恰当的。
- 通话错过传递所需的用户名和密码。
这篇关于设置ClientCredentials:让"用户名不提供"错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!