您的位置:首页 > 编程语言 > ASP

SQL Server Compact is not intended for ASP.NET development

2010-10-19 16:05 645 查看
在asp.net程序中部署sql server compact运行程序链接嵌入数据库时抛出异常,显示“SQL Server Compact is not intended for ASP.NET development. ”。

这个问题可以通过在Global.asax中设置AppDomain属性解决,代码如下:

Global
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;

namespace SqlServerCeWebApp
{
    public class Global : System.Web.HttpApplication
    {

        protected void Application_Start(object sender, EventArgs e)
        {
            AppDomain.CurrentDomain.SetData("SQLServerCompactEditionUnderWebHosting", true);
        }

        protected void Application_End(object sender, EventArgs e)
        {

        }
    }
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐