天蓝色 – 不在托管服务或开发结构中运行(生产,而不是调试/本地)

前端之家收集整理的这篇文章主要介绍了天蓝色 – 不在托管服务或开发结构中运行(生产,而不是调试/本地)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚开始使用Windows Azure,并使用Azure模拟器在本地运行的一个小型MVC应用程序。我注册了免费试用版,下载了我的发布资料并将其导入VS2012。发布到Azure并得到一些程序集参考错误。我通过设置它们来复制local = true来解决这个问题,现在我得到:
  1. Not running in a hosted service or the Development Fabric.
  2. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
  3.  
  4. Exception Details: System.InvalidOperationException: Not running in a hosted service or the Development Fabric.
  5.  
  6. Source Error:
  7.  
  8. An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
  9.  
  10. Stack Trace:
  11.  
  12.  
  13. [InvalidOperationException: Not running in a hosted service or the Development Fabric.]
  14. Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +447
  15. Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +40
  16.  
  17. [ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,Microsoft.WindowsAzure.Diagnostics,Version=1.8.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35.]
  18. System.Diagnostics.TraceUtils.GetRuntimeObject(String className,Type baseType,String initializeData) +6792949
  19. System.Diagnostics.TypedElement.BaseGetRuntimeObject() +45
  20. System.Diagnostics.ListenerElement.GetRuntimeObject() +83
  21. System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +143
  22. System.Diagnostics.TraceInternal.get_Listeners() +181
  23. System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType,Int32 id,String format,Object[] args) +155
  24. DotNetOpenAuth.Loggers.TraceLogger.Info(Object message) +26
  25. DotNetOpenAuth.Logger.CreateWithBanner(String name) +45
  26. DotNetOpenAuth.Logger..cctor() +14
  27.  
  28. [TypeInitializationException: The type initializer for 'DotNetOpenAuth.Logger' threw an exception.]
  29. DotNetOpenAuth.Logger.get_Library() +14
  30. DotNetOpenAuth.Reporting.Initialize() +410
  31. DotNetOpenAuth.Reporting.set_Enabled(Boolean value) +31
  32. DotNetOpenAuth.Reporting..cctor() +285
  33.  
  34. [TypeInitializationException: The type initializer for 'DotNetOpenAuth.Reporting' threw an exception.]
  35. Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +41
  36.  
  37. [InvalidOperationException: The pre-application start initialization method Start on type Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: The type initializer for 'DotNetOpenAuth.Reporting' threw an exception..]
  38. System.Web.Compilation.BuildManager.InvokePreStartInitMethodscore(ICollection`1 methods,Func`1 setHostingEnvironmentCultures) +550
  39. System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
  40. System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
  41. System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
  42. System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,IApplicationHost appHost,IConfigMapPathFactory configMapPathFactory,HostingEnvironmentParameters hostingParameters,PolicyLevel policyLevel,Exception appDomainCreationException) +516
  43.  
  44. [HttpException (0x80004005): The pre-application start initialization method Start on type Microsoft.Web.WebPages.OAuth.PreApplicationStartCode threw an exception with the following error message: The type initializer for 'DotNetOpenAuth.Reporting' threw an exception..]
  45. System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
  46. System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
  47. System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context) +254
  48.  
  49.  
  50.  
  51. --------------------------------------------------------------------------------

如果您在本地进行测试并将Web项目设置为启动项目而不是云项目,则会看到此错误,但正如我所说,这对于仿真器在本地运行良好,但是部署到Azure会导致此失败。

任何想法我在这里失踪?

谢谢

解决方法

将Windows Azure角色项目设置为“启动”项目。这解决了我的问题。当我在与启动项目相同的解决方案中设置另一个webapp时,遇到同样的问题。

猜你在找的asp.Net相关文章