I have upgraded my web service project from vs 2005 to 2012. My webservice uses a project to log status in event viewer, which inturn uses enterprise library 2.0. Now that i have upgraded, i changed all my configs and dlls to newer version but while debugging i get this following exception.
{"Activation error occurred while trying to get instance of type LogWriter, key """}
InnerException:
{"Resolution of the dependency failed, type = "Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter", name = "(none)".
Exception occurred while: while resolving.
Exception is: InvalidOperationException - The type LogWriter cannot be constructed. You must configure the container to supply this value.
At the time of the exception, the container was:
Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)
"}
StackTrace :
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable1 resolverOverrides)
at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key)
at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
Could you please help me out with this, as i ve been working on this issue for 3 days now with no luck.
app.config:
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<section name="EnService.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" requirePermission="false" />
</sectionGroup>
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
<add source="EnService" formatter="Text Formatter" log="MPASLog"
machineName="" listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
traceOutputOptions="None" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</listeners>
<formatters>
<add template="Timestamp: {timestamp}
Message: {message}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
Title:{title}
Machine: {machine}
Application Domain: {appDomain}
Process Id: {processId}
Process Name: {processName}
Win32 Thread Id: {win32ThreadId}
Thread Name: {threadName}
Extended Properties: {dictionary({key} - {value}
)}"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Formatted EventLog TraceListener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Uncomment the below section to write to the Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<applicationSettings>
<EnService.My.MySettings>
<setting name="CONST_PRINT_LOG" serializeAs="String">
<value>1</value>
</setting>
<setting name="CONST_JOB_STATUS_SUCCESS" serializeAs="String">
<value>1</value>
</setting>
<setting name="CONST_WEB_SERVICE_TIME_OUT" serializeAs="String">
<value>10800000</value>
</setting>
<setting name="Seperater" serializeAs="String">
<value>.</value>
</setting>
<setting name="EnService_EnServiceWebReference_EnServiceService" serializeAs="String">
<value>http://localhost/EnServiceService.asmx</value>
</setting>
<setting name="PrintFolder" serializeAs="String">
<value>C:\Jobs\PrintDocuments\</value>
</setting>
<setting name="ResultLocation" serializeAs="String">
<value>C:\Jobs\EnService\Result</value>
</setting>
<setting name="ArchiveFilePrefix" serializeAs="String">
<value>EnService_Report_</value>
</setting>
<setting name="ExceptionArchiveFilePrefix" serializeAs="String">
<value>EnService_Exception_Report_</value>
</setting>
<setting name="CONST_PRINT_REPORT" serializeAs="String">
<value>X</value>
</setting>
<setting name="ReportArchiveLocation" serializeAs="String">
<value>C:\Jobs\EnService\OUT</value>
</setting>
<setting name="CommonWebServiceURL" serializeAs="String">
<value>http://localhost/WebService/Service.asmx</value>
</setting>
</EnService.My.MySettings>
</applicationSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
Appreciate your help,
Vinay
I was using logger.write() in my application
When i added
" Logger.SetLogWriter(New LogWriterFactory().Create(), False) "`
My application worked fine.
Related
I am making an api and I want to read from the web.config an integer value. I tried to do it like this:
<applicationSettings>
<HHH.Properties.Settings>
<setting name="loggerPath" serializeAs="String">
<value>Logs</value>
</setting>
<setting name="querytime" serializeAs="String">
<value>30</value>
</setting>
<setting name="windowstime" serializeAs="String">
<value>86400</value>
</setting>
<setting name="alarmarmingtime" serializeAs="String">
<value>300</value>
</setting>
</HHH.Properties.Settings>
</applicationSettings>
The value I want to read is the windowstime but it throws me an error.
In the serializeAs property I cannot choose "integer" for example because it is an enumerated one and it does not have this option. How should I do it?
I already resolved it. I used this:
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="windowstime" value="86400"/>
</appSettings>
I have two projects:
The first one (VTB_Terminliste) was build as a class library (.dll) with Entity Framework.
The second one is the main application, which include VTB_Terminliste as .dll, which I want to show after click button, like:
Private Sub btnTerminliste_Click(sender As Object, e As EventArgs) Handles btnTerminliste.Click
Dim l As New VTB_Terminliste.MainView
l.Show()
End Sub
In my App.Config from main application I insert the connection string for my Entites
<add name="ATX_PLSNGEntities" connectionString="metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string="data source=atx-srv-58;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
After start and click the button btnTerminliste I get an error "No connection string named 'ATX_PLSNGEntities' could be found in the application config file"
If I start VTB_Terminliste project as WinForm every thing is working.
Here are my App.Config from project VTB_Terminliste and the main application
VTB_Terminliste
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System">
<section name="DevExpress.LookAndFeel.Design.AppSettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<DevExpress.LookAndFeel.Design.AppSettings>
<setting name="DefaultAppSkin" serializeAs="String">
<value>Skin/The Bezier</value>
</setting>
<setting name="DefaultPalette" serializeAs="String">
<value>Gloom Gloom</value>
</setting>
<setting name="TouchUI" serializeAs="String">
<value></value>
</setting>
<setting name="TouchScaleFactor" serializeAs="String">
<value></value>
</setting>
<setting name="DirectX" serializeAs="String">
<value>True</value>
</setting>
<setting name="RegisterUserSkins" serializeAs="String">
<value></value>
</setting>
<setting name="FontBehavior" serializeAs="String">
<value></value>
</setting>
<setting name="DefaultAppFont" serializeAs="String">
<value></value>
</setting>
<setting name="DPIAwarenessMode" serializeAs="String">
<value>System</value>
</setting>
</DevExpress.LookAndFeel.Design.AppSettings>
</applicationSettings>
<system.diagnostics>
<sources>
<!-- Dieser Abschnitt definiert die Protokollierungskonfiguration für My.Application.Log -->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog" />
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben, um in das Anwendungsereignisprotokoll zu schreiben -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information" />
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter" />
<!-- Auskommentierung des nachfolgenden Abschnitts aufheben und APPLICATION_NAME durch den Namen der Anwendung ersetzen, um in das Anwendungsereignisprotokoll zu schreiben -->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<connectionStrings>
<add name="ATX_PLSNGEntities" connectionString="metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string="data source=atx-srv-58;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Main application
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
</configSections>
<connectionStrings>
<add name="ATX_DBA_Test_Connection" connectionString="XpoProvider=MSSqlServer;data source=atx-srv-28;user id=sa;password=Zu3545Uz;initial catalog=ATX_DBA_Test;Persist Security Info=true" />
<add name="ATX_PLSNGEntities" connectionString="metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string="data source=atx-srv-58;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
</startup>
</configuration>
I hope someone can help find me a solution.
I solve my problem adding the connection string inside .Context.vb
Partial Public Class ATX_PLSNGEntities
Inherits DbContext
Public Sub New()
MyBase.New("metadata=res://*/DBA_Terminliste.csdl|res://*/DBA_Terminliste.ssdl|res://*/DBA_Terminliste.msl;provider=System.Data.SqlClient;provider connection string='data source=SomeServer;initial catalog=ATX_PLSNG;persist security info=True;user id=SomeUser;password=SomePW;MultipleActiveResultSets=True;App=EntityFramework'")
End Sub
Protected Overrides Sub OnModelCreating(modelBuilder As DbModelBuilder)
Throw New UnintentionalCodeFirstException()
End Sub
Public Overridable Property Terminliste() As DbSet(Of Terminliste)
End Class
I an developing a Windows form Application using VB. My software will connect to a SQL Database and to a Google Adwords API. The problem is when I try to Add the keys for the Adwords Api in the App.config file I get the following error: "Configuration system failed to initialize: AdWordsApi configuration section not recognized". I have read some examples about hoy to fill my Appconfig file but nothing seems to work. Could you help me know the proper way to do it? I leave here my App.config file
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXX">
<section name="ReporteExcel.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXX" requirePermission="false"/>
</sectionGroup>
</configSections>
<AdWordsApi>
<add key="MaskCredentials" value="true"/>
<add key="EnableSoapExtension" value="true"/>
<add key="EnableGzipCompression" value="true"/>
<add key="IncludeUtilitiesInUserAgent" value="true"/>
<add key="ProxyServer" value=""/>
<add key="ProxyUser" value=""/>
<add key="ProxyPassword" value=""/>
<add key="ProxyDomain" value=""/>
<add key="DeveloperToken" value="XXXXXXXXXXXXXXXXX"/>
<add key="GeneralClientCustomerId" value="XXX-XXX-XXXX"/>
<add key="CanalDigitalClientCustomerId" value="XXX-XXX-XXXX"/>
<add key="BanamexClientCustomerId" value="XXX-XXX-XXXX"/>
<add key="AuthorizationMethod" value="OAuth2"/>
<add key="OAuth2ClientId" value="XXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com"/>
<add key="OAuth2ClientSecret" value="XXXXXXXXXXXXXX-XXXXXXX"/>
<add key="OAuth2RefreshToken" value="1/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXX-X"/>
<add key="WebClientCustomerId" value="XXX-XXX-XXXX"/>
<add key="SkipReportHeader" value="true"/>
<add key="SkipReportSummary" value="true"/>
<add key="SkipColumnHeader" value="false"/>
</AdWordsApi>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<applicationSettings>
<ReporteExcel.My.MySettings>
<setting name="sqlConnectionStr" serializeAs="String">
<value>Data Source=192.168.2.1;Initial Catalog=CATALOG;User ID=ADMIN;Password=ADMIN;</value>
</setting>
</ReporteExcel.My.MySettings>
</applicationSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Google.AdWords" publicKeyToken="XXXXXXXXXXX" culture="neutral"/>
<bindingRedirect oldVersion="18.33.0.0" newVersion="18.34.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Google.Ads.Common" publicKeyToken="XXXXXXXXXXXXXX" culture="neutral"/>
<bindingRedirect oldVersion="3.17.0.0" newVersion="3.18.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
As it reads the file, the configSections act as a Table of Contents for the file
Try the following change and see if it will recognize it. taken from here
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXX">
<section name="ReporteExcel.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXX" requirePermission="false"/>
</sectionGroup>
<section name="AdWordsApi" type="System.Configuration.DictionarySectionHandler"/>
</configSections>
My project consists of a web service (WCF) and a console application that uses a common library in other projects.
This library has ApplicationSettings.
With Console application, I only have to set:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="MyProject.Library.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
[...]
<applicationSettings>
<MyProject.Library.Properties.Settings>
<setting name="EnvironmentMask" serializeAs="String">
<value>RCT_</value>
</setting>
</MyProject.Library.Properties.Settings>
</applicationSettings>
[...]
</configuration>
I tried to do the same side Web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="MyCompany.ConfigurationGroup">
<section name="SignedFileConfiguration" type="MyCompany.Web.SecureFileProxy.SignedFileConfigurationHandler, Net.MyCompany.Web" />
</sectionGroup>
<sectionGroup name="applicationSettings">
<section name="MyProject.Library.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
[...]
<MyCompany.ConfigurationGroup>
<SignedFileConfiguration Secret="SecretKey!" PatternOfGeneratedUrl="http://www.myCompany.net/cgi/getFile.aspx?volume={0}&path={1}&token={2}&name={3}" ConfiguratorType="MyCompany.Web.SecureFileProxy.SignedFileConfiguration, Net.MyCompany.Web">
<Volumes>
<add Name="fallow" PhysicalPath="" />
</Volumes>
</SignedFileConfiguration>
</MyCompany.ConfigurationGroup>
<applicationSettings>
<MyProject.Library.Properties.Settings>
<setting name="EnvironmentMask" serializeAs="String">
<value>DEV_</value>
</setting>
</MyProject.Library.Properties.Settings>
</applicationSettings>
[...]
</configuration>
During the execution of the web service, I get an exception : System.Configuration.SettingsPropertyNotFoundException and the object MyProject.Library.Properties.Settings is empty
the only website which talk about that is https://littletalk.wordpress.com/2008/05/07/use-applicationsettings-in-web-application/ but it isn't enought for me.
I hope you could help me.
Thanks for your attention
Regards
I found the cause of this issue.
it's because I use log4net and it has an issue https://issues.apache.org/jira/browse/LOG4NET-398
I have to find a new way to do it.
I started to use Azure in-role caching and everything works great in Azure compute emulator on my local machine, but not on server. I've already dealed with some problems, like lack of msshrtmi.dll on server, but now can't understand why get this error:
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() +535
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener..ctor() +34
[ConfigurationErrorsException: Could not create Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.]
System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type baseType, String initializeData) +1588
System.Diagnostics.TypedElement.BaseGetRuntimeObject() +103
System.Diagnostics.ListenerElement.GetRuntimeObject() +825
System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +261
System.Diagnostics.TraceInternal.get_Listeners() +256
System.Diagnostics.Trace.get_Listeners() +79
Microsoft.ApplicationServer.Caching.DataCacheServerLogManager..cctor() +97
[TypeInitializationException: The type initializer for 'Microsoft.ApplicationServer.Caching.DataCacheServerLogManager' threw an exception.]
Microsoft.ApplicationServer.Caching.DataCacheServerLogManager.ChangeLogLevel(TraceLevel traceLevel) +0
Microsoft.ApplicationServer.Caching.ServiceConfigurationManager..cctor() +24
[TypeInitializationException: The type initializer for 'Microsoft.ApplicationServer.Caching.ServiceConfigurationManager' threw an exception.]
Microsoft.ApplicationServer.Caching.ServiceConfigurationManager.GetHostDefaults() +0
Microsoft.ApplicationServer.Caching.OMCacheNodeProperties..ctor(IHostConfiguration props, Int32 maxNC, Boolean perfCounterRequired) +69
Microsoft.ApplicationServer.Caching.LocalCacheStore..ctor(EvictionParametrs evictionParams) +50
Microsoft.ApplicationServer.Caching.DataCacheFactory..ctor(DataCacheFactoryConfiguration configuration) +555
Microsoft.Web.DistributedCache.DataCacheFactoryWrapper.CreateDataCacheFactoryFromConfiguration(DataCacheFactoryConfiguration config) +35
Microsoft.Web.DistributedCache.CacheHelpers.RunCacheCreationHooks(CacheConnectingEventArgs fetchingEventArgs, IDataCacheFactory dataCacheFactory, Object sender, EventHandler`1 fetchingHandler, EventHandler`1 fetchedHandler) +70
Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.CreateInternalProvider(IHttpRuntime httpRuntime, OutputCacheInitializationData initData, IDataCacheFactory dataCacheFactory, EventHandler`1 cacheFetching, EventHandler`1 cacheFetched) +123
Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.GetInternalProvider() +224
Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider.Get(String key) +13
System.Web.Caching.OutputCache.Get(String key) +80
System.Web.Caching.OutputCacheModule.OnEnter(Object source, EventArgs eventArgs) +321
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +182
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
All I found about this error is that it occurs if you start local Azure compute emulator with in-role caching and without administrative rights. But in emulator everything works fine and problem occurs only after I publish to staging environment. (if switch to production, error remains).
I use cache for resolving routes like /username and /countryname etc. So available usernames and country names will be cached and updated on changes in database. I have static class with static DataCache object which is created on first request to cache. But even home page doesn't start so error occurs before I try to create cache object.
Web.Config. Is I remove all cache and cache diagnostics related configurations from web.config, app starts.
<configuration>
<configSections>
<section name="dataCacheClients" type="Microsoft.ApplicationServer.Caching.DataCacheClientsSection, Microsoft.ApplicationServer.Caching.Core" allowLocation="true" allowDefinition="Everywhere" />
<section name="cacheDiagnostics" type="Microsoft.ApplicationServer.Caching.AzureCommon.DiagnosticsConfigurationSection, Microsoft.ApplicationServer.Caching.AzureCommon" allowLocation="true" allowDefinition="Everywhere" /></configSections>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics" />
</listeners>
</trace>
</system.diagnostics>
<system.data>
<DbProviderFactories>
<add name="Sql Azure Reliable Provider" invariant="ReliableDbProvider.SqlAzure" description="Reliable Db Provider for SQL Azure" type="ReliableDbProvider.SqlAzure.SqlAzureProvider, ReliableDbProvider" />
<add name="Sql Azure Reliable Provider With Timeout Retries" invariant="ReliableDbProvider.SqlAzureWithTimeoutRetries" description="Reliable Db Provider for SQL Azure with Timeout Retries" type="ReliableDbProvider.SqlAzureWithTimeoutRetries.SqlAzureProvider, ReliableDbProvider" />
</DbProviderFactories>
</system.data>
<connectionStrings>
<add name="AppDB" connectionString="value" />
<add name="StorageConnectionString" connectionString="value" />
</connectionStrings>
<appSettings>
<add key="webpages:Version" value="2.0.0.0" />
<add key="PreserveLoginUrl" value="true" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5" />
</system.Web>
-->
<system.web>
<customErrors mode="Off" />
<roleManager enabled="true" defaultProvider="provider">
<providers>
<clear />
<remove name="AspNetSqlRoleProvider" />
<add name="name" type="type" />
</providers>
</roleManager>
<membership defaultProvider="provider">
<providers>
<clear />
<remove name="AspNetSqlMembershipProvider" />
<add name="name" type="type" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="8" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression="" applicationName="name" />
</providers>
</membership>
<machineKey validationKey="key" decryptionKey="key" validation="SHA1" decryption="AES" />
<httpCookies httpOnlyCookies="true" requireSSL="false" />
<authentication mode="Forms">
<forms loginUrl="~/account/logon" protection="All" path="/" enableCrossAppRedirects="true" timeout="2880" />
</authentication>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<pages controlRenderingCompatibilityVersion="4.0">
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="System.Web.Optimization" />
</namespaces>
</pages>
<httpRuntime maxRequestLength="1048576" />
<globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto" />
<!-- Windows Azure Cache session state provider --><!--<sessionState mode="Custom" customProvider="AFCacheSessionStateProvider">
<providers>
<add name="AFCacheSessionStateProvider" type="Microsoft.Web.DistributedCache.DistributedCacheSessionStateStoreProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheSessionState"/>
</providers>
</sessionState>--><!-- Windows Azure Cache output cache provider --><!--Uncomment this section to use Windows Azure Cache for output cache-->
<caching>
<outputCache defaultProvider="AFCacheOutputCacheProvider">
<providers>
<add name="AFCacheOutputCacheProvider" type="Microsoft.Web.DistributedCache.DistributedCacheOutputCacheProvider, Microsoft.Web.DistributedCache" cacheName="default" dataCacheClientName="default" applicationName="AFCacheOutputCache" />
</providers>
</outputCache>
</caching>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
</staticContent>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="false" />
<directoryBrowse enabled="false" />
<httpProtocol>
<customHeaders>
<!-- Enable Cross Domain AJAX calls -->
<remove name="Access-Control-Allow-Origin" />
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<handlers>
<add name="UrlRoutingHandler" type="System.Web.Routing.UrlRoutingHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" path="path" verb="GET" />
<add name="UrlRoutingHandlerEmailLogo" type="System.Web.Routing.UrlRoutingHandler,System.Web, Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" path="path" verb="GET" />
<add name="UrlRoutingHandlerSitemap" type="System.Web.Routing.UrlRoutingHandler, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" path="path" verb="GET" />
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Diagnostics" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network host="host" userName="username" password="password" />
</smtp>
</mailSettings>
</system.net>
<system.web.extensions>
<scripting>
<webServices>
<jsonSerialization maxJsonLength="2147483644" />
</webServices>
</scripting>
</system.web.extensions>
<dataCacheClients>
<dataCacheClient name="default">
<autoDiscover isEnabled="true" identifier="sub2o" />
<localCache isEnabled="true" sync="TimeoutBased" objectCount="100000" ttlValue="300" />
</dataCacheClient>
</dataCacheClients>
<cacheDiagnostics>
<crashDump dumpLevel="Off" dumpStorageQuotaInMB="100" />
</cacheDiagnostics>
</configuration>
ServiceConfiguration.Cloud.cscfg
<ServiceConfiguration serviceName="WindowsAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2013-10.2.2">
<Role name="sub2o">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=name;AccountKey=key" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="username" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="password" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2014-09-07T23:59:59.0000000+04:00" />
<Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
<Setting name="Microsoft.AppInsights.AccountId" value="ID" />
<Setting name="Microsoft.AppInsights.InstrumentationKey" value="KEY" />
<Setting name="Microsoft.AppInsights.EnableMonitoring" value="true" />
<!-- Uncomment the following section if you want to change the Display Name of your application on the Application Insights Portal. (Default is your WebRole Name)-->
<!--<Setting name="Microsoft.AppInsights.DisplayName" value="Name" />-->
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.NamedCaches" value="{"caches":[{"name":"default","policy":{"eviction":{"type":0},"expiration":{"defaultTTL":10,"isExpirable":true,"type":1},"serverNotification":{"isEnabled":false}},"secondaries":0}]}" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.DiagnosticLevel" value="1" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.CacheSizePercentage" value="30" />
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="DefaultEndpointsProtocol=https;AccountName=name;AccountKey=key" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="value" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
ServiceDefinition.csdef
<?xml version="1.0"?>
<ServiceDefinition name="WindowsAzure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-10.2.2">
<WebRole name="sub2o" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
<Import moduleName="Caching" />
</Imports>
<Startup priority="-2">
<Task commandLine="AppInsightsAgent\UnifiedBootstrap.bat" executionContext="elevated" taskType="background">
</Task>
<Task commandLine="Microsoft.WindowsAzure.Caching\ClientPerfCountersInstaller.exe install" executionContext="elevated" taskType="simple" />
</Startup>
<ConfigurationSettings>
<Setting name="Microsoft.AppInsights.AccountId" />
<Setting name="Microsoft.AppInsights.InstrumentationKey" />
<Setting name="Microsoft.AppInsights.EnableMonitoring" />
<!-- Uncomment the following section if you want to change the Display Name of your application on the Application Insights Portal. (Default is your WebRole Name)-->
<!--<Setting name="Microsoft.AppInsights.DisplayName" />-->
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" />
</ConfigurationSettings>
<LocalResources>
<LocalStorage name="DiagnosticStore" sizeInMB="20000" cleanOnRoleRecycle="false" />
</LocalResources>
</WebRole>
</ServiceDefinition>
Problem was caused by conflict between SDK 2.2 and 2.3. Just need to update SDK for Windows Azure Cloud Service project from Properties->Application. So simple.