MessageSecurityException:客户端身份验证方案“Anonymous”禁止HTTP请求 [英] MessageSecurityException : The HTTP request was forbidden with client authentication scheme 'Anonymous'

查看:463
本文介绍了MessageSecurityException:客户端身份验证方案“Anonymous”禁止HTTP请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


i尝试使用服务引用请求xml,但失败并显示消息  client
authentication scheme'匿名'。
 我可能知道问题是什么吗?

i tried to request the xml by using service reference but failed with the message client authentication scheme 'Anonymous'. may i know what's the problem ??


以下是我的类文件和app.co nfig代码。我成功请求  movelist   xml
但是当我试图请求  客户列表 它
显示错误消息。

below are my class file and app.config code. I succeeded to requested movelist xml but when i tried to requested clientlist it show the error message.


program.cs

ServiceReference1.DataServiceClient ws = new ServiceReference1.DataServiceClient();

ServiceReference1.GetClientListRequest req = new ServiceReference1.GetClientListRequest();
ServiceReference1.GetMovieListRequest req = new ServiceReference1.GetMovieListRequest();

DataResponse dres = new DataResponse();
dres= ws.GetClientList(req);
dres = ws.GetMovieList(req);



app.confg

<?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > <section name="VistaWebClient.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> </sectionGroup> </configSections> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <applicationSettings> <VistaWebClient.Properties.Settings> <setting name="VistaWebClient_my_com_tgv_test_DataService" serializeAs="String"> <value>http://test.tgv.com.my/WSVistaWebClient/DataService.asmx</value> </setting> </VistaWebClient.Properties.Settings> </applicationSettings> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="DataService" > </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://test.tgv.com.my/WSVistaWebClient/DataService.asmx" binding="basicHttpBinding" bindingConfiguration="DataService" contract="ServiceReference1.DataService" name="DataService" /> </client> </system.serviceModel> </configuration>

推荐答案

嗨Lawrencems ,

Hi Lawrencems,

您的意思是客户端代码和app.config是通过添加服务引用自动生成的吗?

Do you mean the client code and app.config is automatically generated by adding service reference?

您能否共享我们的服务web.config ?

Could you share us your service web.config?

对于此错误消息,它是由客户端和服务之间的不匹配身份验证引起的。

Per to this error message, it is caused by the mismatch authentication between client and service.

最好的问候,

Edward


这篇关于MessageSecurityException:客户端身份验证方案“Anonymous”禁止HTTP请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆