嵌套的dart项目阻止ServiceStack.Razor视图呈现

时间:2014-03-12 15:42:20

标签: c# dart servicestack servicestack-razor

情况

我正在使用许可的ServiceStack 4.0.12开发纯ServiceStack / Razor应用程序(没有MVC4或Web API)。我有一个视图(cshtml)引用一个从dart项目(使用AngularDart)转换的Javascript文件。

为方便起见,我将dart项目文件夹嵌套在ServiceStack项目中,但不将其包含在Visual Studio中。然后我分别使用Dart编辑器处理我的dart项目。

整个项目结构如下所示:

MyApp.csproj
Global.asax.cs
\Controllers           <- contains the IService formatted by 'Views\index.cshtml'.
\Dart                  <- not included in Visual Studio project.
     \packages
     \build
           \myapp.dart.js
     \lib
     \web
         \myapp.dart
\Views                 
      \index.cshtml    <- references 'myapp.dart.js'

我在本地IIS中设置了一个简单的,工作正常的ServiceStack / Razor'Hello World',然后切换到Dart编辑器来设置我的dart项目。

问题

想象一下,几分钟后我的挫败感转回来,却发现我的美丽“Hello World”已经被“指数快照”所取代。没有触及一行代码,配置或重新编译。

当我切换到IIS Express时,ServiceStack / Razor应用程序将再次正常工作。相同的代码,不需要更改配置或重新编译。

在丢失头发几个小时后,调试各种配置设置并使用沙盒项目无效,我碰巧移动VS项目文件夹中的'Dart'文件夹,修改了Web.config并刷新了应用程序 - 和该应用再次运作!

果然,当我将'Dart'文件夹放回项目文件夹,修改了Web.config并刷新时 - 应用程序再次恢复为快照。

问题

当然,我的问题是,有人可以告诉我为什么在ServiceStack项目文件夹中嵌套Dart项目文件夹会导致ServiceStack.Razor停止呈现视图吗?

修改:更多信息

Dart文件夹包含以下文件类型:

  • pubspec.yaml
  • pubspec.lock
  • *。JS
  • *。镖
  • *。JSON
  • “web”文件夹中“packages”文件夹的快捷方式(DartEditor创建此文件)

编辑:来自Mythz的建议的更多信息

?debug=requestinfo
产生了以下StartUpErrors:

"StartUpErrors": [
        {
            "ErrorCode": "UnauthorizedAccessException",
            "Message": "Access to the path 'D:\\Semi Da Vinci\\git\\BEAU\\BEAU.Beaufort.git\\Source\\BEAU.Beaufort.Website\\Dart\\packages\\analyzer' is denied.",
            "StackTrace": "[Object: 12/03/2014 4:44:51 PM]:\n[REQUEST: ]\nSystem.UnauthorizedAccessException: Access to the path 'D:\\Semi Da Vinci\\git\\BEAU\\BEAU.Beaufort.git\\Source\\BEAU.Beaufort.Website\\Dart\\packages\\analyzer' is denied.\r\n   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n   at System.IO.FileSystemEnumerableIterator`1.CommonInit()\r\n   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)\r\n   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)\r\n   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetMatchingFilesInDir(String globPattern)\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()\r\n   at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()\r\n   at ServiceStack.Formats.MarkdownFormat.<FindMarkdownPages>d__7.MoveNext()\r\n   at ServiceStack.Formats.MarkdownFormat.RegisterMarkdownPages(String dirPath)\r\n   at ServiceStack.Formats.MarkdownFormat.Register(IAppHost appHost)\r\n   at ServiceStack.ServiceStackHost.LoadPlugin(IPlugin[] plugins)",
            "Errors": []
        },
        {
            "ErrorCode": "UnauthorizedAccessException",
            "Message": "Access to the path 'D:\\Semi Da Vinci\\git\\BEAU\\BEAU.Beaufort.git\\Source\\BEAU.Beaufort.Website\\Dart\\packages\\analyzer' is denied.",
            "StackTrace": "[Object: 12/03/2014 4:44:51 PM]:\n[REQUEST: ]\nSystem.UnauthorizedAccessException: Access to the path 'D:\\Semi Da Vinci\\git\\BEAU\\BEAU.Beaufort.git\\Source\\BEAU.Beaufort.Website\\Dart\\packages\\analyzer' is denied.\r\n   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n   at System.IO.FileSystemEnumerableIterator`1.CommonInit()\r\n   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)\r\n   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)\r\n   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetMatchingFilesInDir(String globPattern)\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()\r\n   at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()\r\n   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\r\n   at ServiceStack.EnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 action)\r\n   at ServiceStack.Razor.Managers.RazorViewManager.Init()\r\n   at ServiceStack.Razor.RazorFormat.Init()\r\n   at ServiceStack.Razor.RazorFormat.Register(IAppHost appHost)",
            "Errors": []
        },
        {
            "ErrorCode": "UnauthorizedAccessException",
            "Message": "Access to the path 'D:\\Semi Da Vinci\\git\\BEAU\\BEAU.Beaufort.git\\Source\\BEAU.Beaufort.Website\\Dart\\packages\\analyzer' is denied.",
            "StackTrace": "[Object: 12/03/2014 4:44:51 PM]:\n[REQUEST: ]\nSystem.UnauthorizedAccessException: Access to the path 'D:\\Semi Da Vinci\\git\\BEAU\\BEAU.Beaufort.git\\Source\\BEAU.Beaufort.Website\\Dart\\packages\\analyzer' is denied.\r\n   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)\r\n   at System.IO.FileSystemEnumerableIterator`1.CommonInit()\r\n   at System.IO.FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler, Boolean checkHost)\r\n   at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)\r\n   at ServiceStack.VirtualPath.FileSystemVirtualDirectory.GetMatchingFilesInDir(String globPattern)\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at ServiceStack.VirtualPath.AbstractVirtualDirectoryBase.<GetAllMatchingFiles>d__0.MoveNext()\r\n   at System.Linq.Enumerable.<SelectManyIterator>d__14`2.MoveNext()\r\n   at System.Linq.Enumerable.<DistinctIterator>d__81`1.MoveNext()\r\n   at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\r\n   at ServiceStack.EnumerableExtensions.Each[T](IEnumerable`1 values, Action`1 action)\r\n   at ServiceStack.Razor.Managers.RazorViewManager.Init()\r\n   at ServiceStack.Razor.RazorFormat.Init()\r\n   at ServiceStack.Razor.RazorFormat.Register(IAppHost appHost)\r\n   at ServiceStack.ServiceStackHost.LoadPlugin(IPlugin[] plugins)",
            "Errors": []
        }
    ],

仔细观察,/ packages下面的文件夹是系统缓存中原始库的符号链接(更多信息请参见:https://www.dartlang.org/tools/pub/faq.html)。

似乎ServiceStack正在绊倒这些符号链接。

1 个答案:

答案 0 :(得分:1)

使用.NET的文件IO API无法在Windows中扫描符号链接时出现问题,而现在这些文件IO API已成为logged as warnings in this commit。此修复程序位于MyGet now或NuGet上的下一个 v4.0.13 + 中。