返回remoteAddress的成员资格提供程序为Null

时间:2013-04-24 19:01:18

标签: c# wcf client membership provider

我们正在使用专有的单点登录服务来远程进行会员呼叫。我们通过VPN连接。

我们遇到错误:

Service.Web.Security.Membership.ValidateUser(username, password);

无论VPN是否正常工作:

堆栈追踪:

[ArgumentNullException:Value不能为null。     参数名称:remoteAddress]        System.ServiceModel.ClientBase`1..ctor(String endpointConfigurationName,String remoteAddress)+3235973        ProprietaryService.Security.Membership.MembershipServiceProxy.ValidateUser(String applicationName,String username,String password,Int32 maxInvalidPasswordAttempts)+231        ProprietaryService.Security.Membership.MembershipProvider.ValidateUser(String username,String password)+27        System.Web.Security.Membership.ValidateUser(String username,String password)+26        LoginForm.ascx.cs中的includes_usercontrols_LoginForm.btnLogin_Click(Object sender,EventArgs e):91        System.Web.UI.WebControls.Button.OnClick(EventArgs e)+9553178        System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)+103        System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)+10        System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13        System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)+35        System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint)+1724'

Web的相关领域.Config:

 <system.web>
        <membership defaultProvider="MembershipProvider">
            <providers>
                <clear />
                <add name="MembershipProvider"
                     type="ProprietaryMembershipAPIName1, ProprietaryMembershipAPIName2"
                     connectionStringName="ConnectionStringToRemoteDB1" enablePasswordRetrieval="false" enablePasswordReset="true"
                     requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5"
                     minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
                     applicationName="RemoteAppName" />
            </providers>
        </membership>
    </service.web>
    <system.serviceModel>
        <bindings>
    <netTcpBinding>
                <binding name="MembershipProvider_NetTcpBinding" closeTimeout="00:01:00"
            openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
            transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions"
            hostNameComparisonMode="StrongWildcard" listenBacklog="10"
            maxBufferPoolSize="524288" maxBufferSize="65536" maxConnections="10"
            maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
                    <security mode="None">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
<client>
            <endpoint address=""
                binding="netTcpBinding" bindingConfiguration="Membership_NetTcpBinding"
                contract="MembershipProviderService.MembershipService" name="Membership_NetTcpBinding" >

            </endpoint>
</client>

我们可以通过ConnectionStringToRemoteDB1中的凭据远程访问数据库。我们被告知'MembershipProviderService.MembershipService'和相关API旨在从数据库获取远程地址并将其提供给成员提供商。

有没有人在这里看到配置有任何问题,这些问题让人觉得这不起作用? 这感觉就像缺少配置片,但是通过VPN跨域消费服务使得很难知道问题可能是什么。感谢您提前提出任何建议!

1 个答案:

答案 0 :(得分:1)

您遇到的错误是因为您的web.config中的这一行:

<endpoint address=""

在异常情况下,它正在尝试创建WCF客户端:

  

System.ServiceModel.ClientBase`1..ctor(字符串   endpointConfigurationName,String remoteAddress)

你不能传递空/空地址。