情况
我正在使用许可的 ServiceStack 4.0.12 开发一个纯 ServiceStack/Razor 应用程序(没有 MVC4 或 Web API)。我有一个视图(cshtml),它引用了一个从 dart 项目(使用 AngularDart)转译的 Javascript 文件。
为方便起见,我将 dart 项目文件夹嵌套在 ServiceStack 项目中,但不包含在 Visual Studio 中。然后,我分别使用 Dart Editor 处理我的 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 应用程序将再次正常工作。相同的代码,无需更改配置或重新编译。
在失去头发几个小时后,戳各种配置设置并玩沙箱项目无效,我碰巧将 'Dart' 文件夹移出 VS 项目文件夹,修改 Web.config 并刷新应用程序 - 应用程序工作再次!
果然,当我将“Dart”文件夹放回项目文件夹时,修改了 Web.config 并刷新 - 应用程序再次恢复为 Snapshot。
问题
当然,我的问题是谁能告诉我为什么将 Dart 项目文件夹嵌套在 ServiceStack 项目文件夹中会导致 ServiceStack.Razor 停止渲染视图?
编辑:更多信息
Dart 文件夹包含以下文件类型:
- 发布规范.yaml
- pubspec.lock
- *.js
- *。镖
- *.json
- 从“web”文件夹到“packages”文件夹的快捷方式(DartEditor 创建这个)
编辑:来自 Mythz 建议的更多信息
?debug=请求信息产生以下 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 在这些符号链接上绊倒了。