Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 我的会员资格申请有什么问题?(使用ClientFormsAuthenticationMembershipProvider)_Asp.net_Vb.net_Authentication_Asp.net Membership_Membership - Fatal编程技术网

Asp.net 我的会员资格申请有什么问题?(使用ClientFormsAuthenticationMembershipProvider)

Asp.net 我的会员资格申请有什么问题?(使用ClientFormsAuthenticationMembershipProvider),asp.net,vb.net,authentication,asp.net-membership,membership,Asp.net,Vb.net,Authentication,Asp.net Membership,Membership,我是否可以运行任何简单的诊断来确定为什么身份验证不能与ClientFormsAuthenticationMembershipProvider一起使用?我的问题是: 我在服务器a上有一个网站(我们称之为“Authenticator”网站),该网站配置为使用AspNetSqlMembershipProvider提供程序进行成员资格和角色管理。该网站的(我认为是)相关web.config键如下: <membership> <providers>

我是否可以运行任何简单的诊断来确定为什么身份验证不能与ClientFormsAuthenticationMembershipProvider一起使用?我的问题是:

我在服务器a上有一个网站(我们称之为“Authenticator”网站),该网站配置为使用AspNetSqlMembershipProvider提供程序进行成员资格和角色管理。该网站的(我认为是)相关web.config键如下:

    <membership>
        <providers>
            <clear />
            <add name="AspNetSqlMembershipProvider"
                 type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
                 connectionStringName="MMMS35.API"
                 enablePasswordRetrieval="false"
                 enablePasswordReset="true"
                 requiresQuestionAndAnswer="false"
                 applicationName="Moose"
                 requiresUniqueEmail="false"
                 passwordFormat="Hashed"
                 maxInvalidPasswordAttempts="5"
                 minRequiredPasswordLength="7"
                 minRequiredNonalphanumericCharacters="0"
                 passwordAttemptWindow="1"
                 passwordStrengthRegularExpression="" />
        </providers>
    </membership>
    <profile>
        <providers>
            <clear />
            <add name="AspNetSqlProfileProvider"
                 connectionStringName="MMMS35.API"
                 applicationName="Moose"
                 type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
    </profile>
    <roleManager enabled="true">
        <providers>
            <clear />
            <add name="AspNetSqlRoleProvider"
                 connectionStringName="MMMS35.API"
                 applicationName="Moose"
                 type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
        </providers>
    </roleManager>
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
        <providers>
            <clear/>
            <add name="ClientAuthenticationMembershipProvider"
                 type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                 serviceUri="http://slmooseapp1/mia/Authentication_JSON_AppService.axd"
                 credentialsProvider=""
                 savePasswordHashLocally="False"/>
        </providers>
    </membership>
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
        <providers>
            <clear/>
            <add name="ClientRoleProvider"
                 type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                 serviceUri="http://slmooseapp1/mia/Role_JSON_AppService.axd"
                 cacheTimeout="1"/>
        </providers>
    </roleManager>
我得到一个例外:

System.UnauthorizedAccessException: Access to the path 'C:\Documents and Settings\Default User\Application Data\Microsoft Corporation\Internet Information Services\6.0.3790.3959' is denied.
但是,当我使用完全相同的web.config serviceUri路径(即,我的客户机成员资格提供程序指向服务器A上的同一身份验证网站)在我的开发箱(而不是服务器B)上运行测试客户机时,验证用户并获取该用户的角色将非常有效

如果我在服务器B上打开浏览器并从身份验证网站请求页面,则身份验证web应用程序运行正常,因此我知道我可以成功地从服务器B向服务器a发出http请求。ClientFormsAuthenticationMembershipProvider在尝试从服务器B向服务器a发出(我认为是)JSON请求时失败,这是怎么回事

编辑(9/21/2009):

现在,我已经在同一个盒子(不是我的开发机器)上使用身份验证网站和测试客户端尝试了这个场景。它仍然失败。我以编程方式编写了一个原始Http请求,并获得了成功的响应

请求:

Content-Type: application/json
Host: slappdev
Content-Length: 70
Expect: 100-continue
Connection: Keep-Alive

{"userName":"mdh","password":"test123","createPersistentCookie":false}
答复:

MicrosoftOfficeWebServer: 5.0_Pub
Content-Length: 10
Cache-Control: private, max-age=0
Content-Type: application/json; charset=utf-8
Date: Mon, 21 Sep 2009 20:10:13 GMT
Set-Cookie: AppName=1756811D52C4619AC78...; path=/; HttpOnly
Server: Microsoft-IIS/6.0
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET

{"d":true}
因此,我猜想在通过.Net framework调用从ValidateUser获取实际HTTP请求时出现了一些问题。有什么想法吗

编辑(9/22/2009):

引发的异常与我的测试客户端网页尝试访问System.Windows.Forms.Application.UserAppDataPath时引发的异常完全相同。将connectionStringName属性添加到membership/providers/add键,该键指向客户端web应用程序上web.config文件中的有效连接字符串名称,将更改异常

System.Data.SqlClient.SqlException: Invalid object name 'ApplicationProperties'. at System.Data.SqlClient.SqlConnection.OnError

那么,如果所有成员资格函数都使用serviceUri,为什么要在客户端本地尝试任何操作呢?而且,我需要运行什么实用程序才能将这些新表/对象添加到我的数据库中,以支持客户端成员资格提供程序?

如果将system.diagnostic标记添加到web.config文件中,它将正常工作。 (我在这里只得到一个空文件,但也没有错误消息。)


ClientAuthenticationMembershipProvider具有脱机缓存功能。如果无法访问实际的成员资格提供程序,客户端成员资格提供程序可以在客户端计算机上缓存凭据并使用这些脱机凭据。此脱机缓存由自动生成并存储在System.Windows.Forms.Application.UserAppDataPath位置的SQL Server Compact Edition数据库文件表示

根据,可以将本地脱机缓存配置为使用数据库。您必须按照文章中的说明手动创建数据库表(在我的9/22编辑中,我还没有创建这些表,并且没有实用程序可以这样做)。我这样做了,但客户端仍然希望在本地计算机上为本地SQL CE文件创建文件夹结构,即使它永远不会创建这样的文件。对于我测试中的每台计算机(本地工作站除外),IIS用户都无权为本地缓存数据库构建该文件夹结构,从而生成UnauthorizedAccessException


我很不高兴A)没有配置键来关闭成员身份的脱机缓存,B)即使将脱机缓存定向到数据库,客户端成员资格提供程序仍然必须为其从未创建的本地缓存文件构建文件夹路径。

我已将此web.config节点添加到身份验证服务器应用程序和测试应用程序中。我还打开了事件日志。没有消息出现在事件日志中,也没有在C:\temp中创建任何文件。
System.Data.SqlClient.SqlException: Invalid object name 'ApplicationProperties'. at System.Data.SqlClient.SqlConnection.OnError
 <system.diagnostics>
        <sources>
            <!-- This section defines the logging configuration for My.Application.Log -->
            <source name="DefaultSource" switchName="DefaultSwitch">
                <listeners>
                    <add name="myListener"/>
                    <!-- Uncomment the below section to write to the Application Event Log -->
                    <!--<add name="EventLog"/>-->
                </listeners>
            </source>
        </sources>
        <switches>
            <add name="DefaultSwitch" value="Information" />
        </switches>
        <sharedListeners>
          <add    name="myListener"
                       type="System.Diagnostics.TextWriterTraceListener"
                       initializeData="c:\temp\MyFile.log" />
            <!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
            <!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
        </sharedListeners>
    </system.diagnostics>