Подтвердить что ты не робот

Не работает в размещенной службе или в разработке Fabric (Production, not debug/local)

Я просто начал работать с Windows Azure и получил небольшое приложение MVC, работающее локально с использованием эмулятора Azure. Я подписался на бесплатную пробную версию, загрузил свой профиль публикации и импортировал его в VS2012. Опубликовано Azure и получил некоторые сборочные справочные ошибки. Я решил это, установив их для копирования local = true, и теперь я получаю:

    Not running in a hosted service or the Development Fabric. 
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. 

Exception Details: System.InvalidOperationException: Not running in a hosted service or the Development Fabric.

Source Error: 

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.  

Stack Trace: 


[InvalidOperationException: Not running in a hosted service or the Development Fabric.]
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.GetDefaultStartupInfoForCurrentRoleInstance() +447
   Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +40

[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
   System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +6792949
   System.Diagnostics.TypedElement.BaseGetRuntimeObject() +45
   System.Diagnostics.ListenerElement.GetRuntimeObject() +83
   System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +143
   System.Diagnostics.TraceInternal.get_Listeners() +181
   System.Diagnostics.TraceInternal.TraceEvent(TraceEventType eventType, Int32 id, String format, Object[] args) +155
   DotNetOpenAuth.Loggers.TraceLogger.Info(Object message) +26
   DotNetOpenAuth.Logger.CreateWithBanner(String name) +45
   DotNetOpenAuth.Logger..cctor() +14

[TypeInitializationException: The type initializer for 'DotNetOpenAuth.Logger' threw an exception.]
   DotNetOpenAuth.Logger.get_Library() +14
   DotNetOpenAuth.Reporting.Initialize() +410
   DotNetOpenAuth.Reporting.set_Enabled(Boolean value) +31
   DotNetOpenAuth.Reporting..cctor() +285

[TypeInitializationException: The type initializer for 'DotNetOpenAuth.Reporting' threw an exception.]
   Microsoft.Web.WebPages.OAuth.PreApplicationStartCode.Start() +41

[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..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +550
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +132
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath) +90
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[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..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9873912
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254



--------------------------------------------------------------------------------

Если вы заметили эту ошибку, если вы тестируете локально и настроили веб-проект как проект запуска, а не облачный проект, но, как я уже сказал, это нормально работает с эмулятором, но развертывание в Azure приводит к сбою.

Любые идеи, что мне здесь не хватает?

Спасибо

4b9b3361

Ответ 1

Задайте проект роли Windows Azure как проект "Запуск". Это решило мою проблему. Я столкнулся с той же проблемой, когда установил другой webapp в том же решении, что и проект запуска.

Ответ 2

Попробуйте удалить конфигурацию прослушивателя трассировки Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener в web.config. См. Эту связанную с сообщением SO. DotNetOpenAuth.Logger, похоже, конфликтует с WAD (асинхронная диагностика Windows).

Удалить прослушиватель трассировки из web.config:

<trace> 
    <listeners> 
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"> 
            <filter type="" /> 
        </add> 
    </listeners> 
</trace>