问题描述
我正在尝试这个示例代码:http://www.dotnetcurry.com/ShowArticle.aspx?ID=624
似乎一切正常,但是当它尝试从 WCF 调用异步方法时,它显示此异常(抱歉,它只是西班牙语):
Se ha producido un error al intentar realizar una seekud al URI'https://samsung/WCF40_SSL_Service/Service.svc'.Puede deberse a un犯罪意图una politica entre dominios adecuada en contexto una politica noapropiada para servicios SOAP.Es posible que necesite ponerse en与公共财产联系信息politica entre dominios y para asegurarse de que permiteenvarencabezados HTTP relacionados con SOAP.埃斯特错误 también puededeberse al uso de tipos internos en el proxy de servicios web sinutilizar el atributo InternalsVisibleToAttribute.旁观者信息,请咨询内部例外.
来自 freetranslation.com 的英文翻译(不确定是否有帮助:)
尝试对 URIhttps://samsung/WCF40_SSL_Service/Service.svc"执行请求时发生错误.由于访问服务的意图控制之间的配置在上下文中的适当控制之间没有政治或不适合服务 SOAP 的政治.可能需要与服务的所有者联系以发布控件之间的政治文件,并确保允许发送与 SOAP 相关的 HTTP 标题.此错误也是由于在服务 Web 代理中使用内部类型而不使用 InternalsVisibleToAttribute 属性造成的.要获取更多信息,请查阅内部异常.
在我看来,这就像一个clientaccesspolicy.
我试图在 fiddler 中查看应用程序是否正在发送 clientaccesspolicy.
我想我一定遗漏了一些微不足道的东西,但我不知道是什么......有什么想法吗??
提前致谢!!!
服务器配置:
<配置><连接字符串><add name="SqlSecureConnection" connectionString="数据源=.;初始目录=aspnetdb;集成安全=SSPI"/></connectionStrings><system.web><roleManager enabled="true"/><认证模式=表单"/><编译调试="true" targetFramework="4.0"/><membership defaultProvider="MySqlMembershipProvider"userIsOnlineTimeWindow="15"><提供者><清除/><添加名称="MySqlMembershipProvider"type="System.Web.Security.SqlMembershipProvider"connectionStringName="SqlSecureConnection"应用名称=/"enablePasswordRetrieval="false"enablePasswordReset="false"requiresQuestionAndAnswer="false"requiresUniqueEmail="true"passwordFormat="散列"/></提供者></会员资格></system.web><system.serviceModel><服务><服务名称="WCF_SecureService.Service"行为配置=服务行为"><端点地址=""绑定=自定义绑定"bindingConfiguration="custBind"合同="WCF_SecureService.IService"></端点></服务></服务><绑定><自定义绑定><绑定名称="custBind"><security authenticationMode="UserNameOverTransport"></security><httpsTransport></httpsTransport></binding></customBinding></绑定><行为><服务行为><行为名称="ServBehave"><serviceMetadata httpsGetEnabled="True"/><serviceDebug includeExceptionDetailInFaults="true"/><serviceCredentials><用户名认证userNamePasswordValidationMode="MembershipProvider"membershipProviderName="MySqlMembershipProvider"/></serviceCredentials></行为></serviceBehaviors></行为><serviceHostingEnvironment multipleSiteBindingsEnabled="true"/></system.serviceModel><system.webServer><modules runAllManagedModulesForAllRequests="true"/></system.webServer></配置>
客户端配置:
<system.serviceModel><绑定><自定义绑定><绑定名称="CustomBinding_IService"><security authenticationMode="UserNameOverTransport"includeTimestamp="true"><secureConversationBootstrap/></安全><textMessageEncoding messageVersion="默认"writeEncoding="utf-8"/><httpsTransport maxReceivedMessageSize="2147483647"maxBufferSize="2147483647"/></binding></customBinding></绑定><客户><端点地址="https://samsung/WCF40_SSL_Service/Service.svc"binding="customBinding" bindingConfiguration="CustomBinding_IService"contract="MyRef.IService" name="CustomBinding_IService"/></客户端></system.serviceModel></配置>一种可能是与SSL证书有关.
看起来您正在针对开发机器运行 https.这里可能的问题是:
- 您尚未安装 SSL 证书
- 您已经安装了自签名 SSL 证书,但客户端不信任它
I'm trying this example code:http://www.dotnetcurry.com/ShowArticle.aspx?ID=624
Everything seems to be ok but when it tries to call the async method from the WCF it shows this exception (sorry it's just in spanish):
English translation from freetranslation.com (not sure it helps:)
This seems to me like a "clientaccesspolicy.
<?
I tried to see in fiddler if the application was sending the clientaccesspolicy.
I think I must be missing something trivial but I can't realize what... Any idea??
Thanks in advance!!!
Server config:
<?
Client config:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_IService">
<security authenticationMode="UserNameOverTransport"
includeTimestamp="true">
<secureConversationBootstrap />
</security>
<textMessageEncoding messageVersion="Default"
writeEncoding="utf-8" />
<httpsTransport maxReceivedMessageSize="2147483647"
maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint
address="https://samsung/WCF40_SSL_Service/Service.svc"
binding="customBinding" bindingConfiguration="CustomBinding_IService"
contract="MyRef.IService" name="CustomBinding_IService" />
</client>
</system.serviceModel>
</configuration>
One possibility is that it is related to the SSL certificate.
It looks like you are running https against a development machine. The possible problems here are:
- You have not installed a SSL certificate
- You have installed a self signed SSL certificate but the client does not trust it
这篇关于从 Silverlight 通过 https 使用 WCF 服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!