ASP.NET profile之 找不到預存程序’dbo.aspnet_CheckSchemaVersion’

來源:互聯網
上載者:User

今天早上做profile的測試,webconfig的配置如下:

 

Code
<configuration>
    <appSettings/>
    <connectionStrings>
        <add name="MsSqlConnString" connectionString="server=WSH-S0712002\SQL2005;user id=sa;password=CjchnwsCq53b4y;database=ReplaceShop;min pool size=4;max pool size=4;packet size=3072" providerName="System.Data.SqlClient"></add>
    </connectionStrings>
    <system.web>
        <compilation debug="true"/>
        <authentication mode="Forms"/>
        <anonymousIdentification enabled="true"/>
        <profile enabled="true" automaticSaveEnabled="false" defaultProvider="SupperStudentProvider">
            <providers>
                <add name="SupperStudentProvider" connectionStringName="MsSqlConnString" type="System.Web.Profile.SqlProfileProvider" applicationName="ReplaceShop 1.0"/>
            </providers>
            <properties>
                <add name="FavoriteColor" allowAnonymous="true" defaultValue="Red" provider="SupperStudentProvider"/>
            </properties>
        </profile>
    </system.web>
</configuration>

 

 

Code
//Anonymous.aspx

<%@ Page Language="C#" %>

<script runat="server">

    void Login(Object s, EventArgs e)
    {
        FormsAuthentication.SetAuthCookie("Bill", false);
        Response.Redirect(Request.Path);
    }

    void Logout(Object s, EventArgs e)
    {
        FormsAuthentication.SignOut();
        Response.Redirect(Request.Path);
    }

    void UpdateProfile(Object s, EventArgs e)
    {
        Profile.FavoriteColor= txtFavoriteColor.Text;
    }
    
    void Page_PreRender()
    {
        lblUsername.Text = Profile.UserName;
        lblFavoriteColor.Text = Profile.FavoriteColor;
    }
        
</script>

<html>
<head>
    <title>Anonymous</title>
</head>
<body>
    <form id="form1" runat="server">

    <asp:Button ID="Button1"
        Text="Login"
        OnClick="Login"
        Runat="Server" />
    <asp:Button ID="Button2"
        Text="Logout"
        OnClick="Logout"
        Runat="Server" />
    <hr />
    <asp:TextBox    
        id="txtFavoriteColor"
        Runat="Server" />
    <asp:Button ID="Button3"
        Text="Update Profile"
        OnClick="UpdateProfile"
        Runat="Server" />
    <hr />
    <b>Username:</b>
    <asp:Label  
        id="lblUsername"
        Runat="Server" />
    <br />
    <b>Favorite Color:</b>
    <asp:Label
        id="lblFavoriteColor"
        Runat="Server" />    
        
    </form>
</body>
</html>

 

發現如下錯誤:

                  找不到預存程序'dbo.aspnet_CheckSchemaVersion'

解決方案:

         導航到目錄C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727,執行aspnet_regsql.exe,一定要選對資料庫(跟webconfig中connectionString中保持一致)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.