2012-11-29 62 views
2

我最近在大约一个小时前尝试将DoddleReports功能实现到我的MVC应用程序中。MVC DoddleReports 404 Not Found

非常积极我跟随了文档到T.但是,当我去输入我的URL时,它给了我一个404找不到。我通过NuGet安装了软件包,我只需要Excel,所以我添加了OpenXML(以及依赖关系)。

我的控制器:

using System; 
using System.Data; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 
using VAGTC.Models; 
using VAGTC.ViewModels; 
using VAGTC.Helpers; 
using DoddleReport.Web; 
using DoddleReport; 

namespace VAGTC.Controllers 
{ 

    public class reportsController : Controller 
    { 
     // 
     // GET: /Excel/ 
     VAGTCEntities db = new VAGTCEntities(); 
     public ActionResult Index() 
     { 
      return View(); 
     } 

     public ReportResult OrganizationReport() 
     { 
      var matrix = from d in db.Organizations 
         select d; 
      var report = new Report(matrix.ToReportSource()); 


      return new ReportResult(report); 
     } 
    } 
} 

的RouterConfig:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.Mvc; 
using System.Web.Routing; 
using DoddleReport.Web; 

    namespace VAGTC 
    { 
    public class RouteConfig 
    { 
     public static void RegisterRoutes(RouteCollection routes) 
     { 
      routes.MapReportingRoute(); 
      routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); 
      routes.MapRoute(
       name: "Default", 
       url: "{controller}/{action}/{id}", 
       defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional } 
      ); 
     } 
    } 
} 

当我的NuGet安装轻而易举 - 它也自动输入在web.config中(未在web.config中所需要的东西查看文件夹!)。我在用MVC配置Doddle的文档中阅读了注释right here,并替换了代码。 (但它也不适用于自动生成的代码)。我没有想到定制任何东西,因为我只是想让它工作第一!

那么,404页面怎么会出现?它使我看起来是与路由的东西,但我不确定具体是什么。

任何帮助,非常感谢!

我在调试模式下使用它 - 所以也许这可能是一个原因?这是我使用的链接:

编辑*上传到我的网站,仍然给出了一个404

http://localhost:2530/reports/OrganizationReport.xls 

EDIT 2 * 按照给定的论坛帖子乱搞,和不断变化的有两件事情之后由@fiorebat。我在它生成报告var report = new Report(matrix.ToReportSource());后立即对其进行调试,并在返回报告后发生此错误。

No Source Available 
There is no source code available for the current location. 

Call stack location: 
DoddleReport.dll!DoddleReport.ReportBuilder.ToReportSource(System.Collections.IEnumerable source) Line 12 

Source file information: 
Locating source for 'c:\Users\Matt\Development\Projects\DoddleReport\src\DoddleReport\ReportBuilder.cs'. Checksum: MD5 {61 dc e5 8e 25 79 c2 94 c4 27 5b d0 d7 92 56 ae} 
The file 'c:\Users\Matt\Development\Projects\DoddleReport\src\DoddleReport\ReportBuilder.cs' does not exist. 
Looking in script documents for 'c:\Users\Matt\Development\Projects\DoddleReport\src\DoddleReport\ReportBuilder.cs'... 
Looking in the projects for 'c:\Users\Matt\Development\Projects\DoddleReport\src\DoddleReport\ReportBuilder.cs'. 
The file was not found in a project. 
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\'... 
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\crt\src\vccorlib\'... 
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\mfc\'... 
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\src\atl\'... 
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include'... 
Looking in directory 'C:\'... 
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: c:\Users\Matt\Development\Projects\DoddleReport\src\DoddleReport\ReportBuilder.cs. 
The debugger could not locate the source file 'c:\Users\Matt\Development\Projects\DoddleReport\src\DoddleReport\ReportBuilder.cs'. 

回答

2

您需要的system.webServer下添加在web配置此配置:

<modules runAllManagedModulesForAllRequests="true" ></modules> 

我有同样的问题,没有扩建工程报告,我与调试“RouteDebuggin”的路线,它的加工。似乎DoodleReport插件不会调用正确的操作。

http://doddlereport.codeplex.com/discussions/348486

+0

谢谢 - 这有所帮助。 'var matrix = from db in db.Organizations select d;' 当我将此代码更改为'd.OrganizationID'时,页面会加载但它是空白的。当我刚刚拿到'select d;'这个页面就在加载时。我还删除了RouteConfig中的“忽略路由”行。 – cfisher

+0

我已完全复制来自示例DoddleReport的产品存储库和其他关联项目。当我添加一个扩展时它仍然给我一个404错误。如果没有扩展,它可以简单地将表格加载到浏览器中。 – cfisher

+0

我abbandoned抄报告,开发该解决方案:http://www.manik-software.co.uk/blog/post/Export-to-Excel-xlsx-from-ASPNET-MVC.aspx 在开始有很多的代码,但是在您可以轻松地脚手架并重新使用查看操作 – fiorebat