【问题标题】:ADO.NET Data Services in an ASP.NET-MVC projectASP.NET-MVC 项目中的 ADO.NET 数据服务
【发布时间】:2009-05-06 16:11:27
【问题描述】:

我正在尝试将 ADO.NET 数据服务添加到普通 ASP.NET-MVC 项目中。有谁知道这些技术是否兼容?

当我 Ctrl+f5 解决方案并访问服务 URL 时,我得到的只是非常无用的“请求错误...查看服务器日志”页面。开发 Web 服务器是否会写入任何日志?如果有,在哪里?

我猜可能是路由的问题,所以我补充说:-

routes.IgnoreRoute("{service}.svc/{*pathInfo}");

试图解决这个问题,但没有帮助。

我宁愿不创建单独的 ASP.NET Web 项目来托管数据服务。在 ASP.NET-MVC 项目中添加数据服务是否有其他标准 ASP.NET 项目不常见的步骤?

【问题讨论】:

    标签: c# asp.net-mvc entity-framework wcf-data-services


    【解决方案1】:

    您是否将调试属性放入服务类?

    **[System.ServiceModel.ServiceBehavior(IncludeExceptionDetailInFaults = true)]**  
    public class MyDataService : DataService<...>
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(IDataServiceConfiguration config)
        {
            // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
            // Examples:
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
    
    
            **config.UseVerboseErrors = true;**
        }
    

    【讨论】:

    • 感谢您为我提供了足够的信息来解决问题。它只是表明有时 Rep 没有任何意义,当您回答我的 13K 时,您在 Rep 1。 :)
    • 文章和源码可能对探索ASP.Net MVC和ADO.Net Data Services组合有用msdn.microsoft.com/en-au/magazine/dd727502.aspx
    猜你喜欢
    • 1970-01-01
    • 2013-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多