Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unrecognized element 'autoDiscover' in web.config thrown by Azure Web Role

I'm trying to use the Session State Provider for Windows Azure Caching on a co-located cache running on two instances of a Web role. I have a ASP.NET MVC4 project. I followed Microsofts guide on how to set it up, and gone through it multiple times but with the same result. When I publish to Azure, I get a YSOD on every page.

I've gone through the logs on my Azure instance and found the exception that is probably causing this:

Event code: 3008 
Event message: A configuration error has occurred. 

...

Exception information: 
    Exception type: DataCacheException 
    Exception message: ErrorCode<ERRCMC0003>:SubStatus<ES0001>:Error in client configuration file.
   at Microsoft.ApplicationServer.Caching.ConfigFile.ThrowException(Int32 errorCode, Exception e)
   at Microsoft.ApplicationServer.Caching.ClientConfigReader.Init(String path)
   at Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration..cctor()

Unrecognized element 'autoDiscover'. (E:\sitesroot\0\web.config line 20)
   at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at Microsoft.ApplicationServer.Caching.ClientConfigReader.Init(String path)

I realize that this has to do with my web.config and this section:

<dataCacheClients> 
  <tracing sinkType="DiagnosticSink" traceLevel="Error" /> 
  <dataCacheClient name="default"> 
    <autoDiscover isEnabled="true"/> 
  </dataCacheClient> 
</dataCacheClients>

But that section is taken straight from the Microsoft guide. I've also tried to uninstall and re-install the WindowsAzure.Caching Nuget-package, which adds the proper entries to the web.config, but it looks exactly the same as well.

I've found this discussion on MSDN about what looks to the be the same issue, but I spinn up a new Azure web role, so I cannot see that it should be related to the GAC and an old version of the SDK in this case, or am I missing something?

Looking through the bin-folder of the deployed site, on my Azure instance, I see that the file version of my Microsoft.ApplicationServer.Caching.Client.dll and Microsoft.ApplicationServer.Caching.Core.dll is 1.0.4621.0. That is the same files that gets referenced in my project when i install the WindowsAzure.Caching Nuget-package. Is this the proper files to use?

After 15 hours of debugging, any input on this would be highly appreciated.

Update:

I've actually gotten this project to work, when I publish it to two instances of a new Web role. I'll start to go through that deployment and see if I can spot any differences.

Update 2:

The difference is that my project uses version 1.0.4621.0of Microsoft.ApplicationServer.Caching.Client.dll and Microsoft.ApplicationServer.Caching.Core.dll, while Microsoft's project uses 1.0.4655.0. So it could actually be that I'm using an old version of the SDK. For some reason my project insist on uploading those files when I publish, even though I delete them, but I'll get back with a complete answer if this solves the problem.

like image 286
Christofer Eliasson Avatar asked Oct 31 '12 10:10

Christofer Eliasson


1 Answers

Try upgrading the latest Azure SDK to 1.7 SP1 or 1.8. Azure SDK 1.8 was just released this week. According to MSDN forums, autoDiscover is only supported in Azure SDK 1.7.1+ for role-based caching.

Azure SDK 1.6 (November 2011) Assembly Version: 1.0.4617.0
Azure SDK 1.7 (June 2012) Assembly Version: 1.0.4621.0
Azure SDK 1.7.1 (June 2012 SP1) Assembly Version: 1.0.4655.0
Azure SDK 1.8 (October 2012) Assembly Version: 1.0.4797.0

like image 146
SliverNinja - MSFT Avatar answered Oct 03 '22 05:10

SliverNinja - MSFT