C# 无法识别的元素';自动发现';在Azure web角色引发的web.config中

C# 无法识别的元素';自动发现';在Azure web角色引发的web.config中,c#,asp.net,asp.net-mvc,azure,azure-caching,C#,Asp.net,Asp.net Mvc,Azure,Azure Caching,我正在尝试在一个Web角色的两个实例上运行的位于同一位置的缓存上使用。我有一个ASP.NETMVC4项目。我接着介绍了如何设置它,并对它进行了多次检查,但结果相同。当我发布到Azure时,我在每个页面上都会得到一个YSOD 我查看了Azure实例上的日志,发现了可能导致以下情况的异常: Event code: 3008 Event message: A configuration error has occurred. ... Exception information: Ex

我正在尝试在一个Web角色的两个实例上运行的位于同一位置的缓存上使用。我有一个ASP.NETMVC4项目。我接着介绍了如何设置它,并对它进行了多次检查,但结果相同。当我发布到Azure时,我在每个页面上都会得到一个YSOD

我查看了Azure实例上的日志,发现了可能导致以下情况的异常:

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)
事件代码:3008
事件消息:发生配置错误。
...
例外信息:
异常类型:DataCacheException
异常消息:错误代码:子状态:客户端配置文件中出现错误。
位于Microsoft.ApplicationServer.Caching.ConfigFile.ThroweException(Int32错误代码,异常e)
位于Microsoft.ApplicationServer.Caching.ClientConfigReader.Init(字符串路径)
在Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration..cctor()上
无法识别的元素“自动发现”。(E:\sitesroot\0\web.config第20行)
在System.Configuration.BaseConfigurationRecord.EvaluateOne(字符串[]键、SectionInput输入、布尔isTrusted、FactoryRecord FactoryRecord、SectionRecord SectionRecord、Object parentResult)
在System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord FactoryRecord、SectionRecord SectionRecord、Object parentResult、Boolean getLkg、Boolean getRuntimeObject、Object&result、Object&resultRuntimeObject)
位于System.Configuration.BaseConfigurationRecord.GetSectionRecursive(字符串configKey、布尔getLkg、布尔checkPermission、布尔getRuntimeObject、布尔RequestISHER、对象与结果、对象与结果EntimeObject)
位于System.Configuration.BaseConfigurationRecord.GetSection(字符串configKey)
位于System.Configuration.ConfigurationManager.GetSection(字符串sectionName)
位于Microsoft.ApplicationServer.Caching.ClientConfigReader.Init(字符串路径)
我意识到这与我的web.config和本节有关:

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

在MSDN上关于什么看起来是相同的问题,但我增加了一个新的Azure web角色,所以我看不出它应该与GAC和旧版本的SDK相关,或者我遗漏了什么

通过查看已部署站点的bin文件夹,在我的Azure实例上,我看到我的
Microsoft.ApplicationServer.Caching.Client.dll和
Microsoft.ApplicationServer.Caching.Core.dll的文件版本是
1.0.4621.0
。这与我安装
WindowsAzure.Caching
Nuget包时在项目中引用的文件相同。这是正确使用的文件吗

经过15个小时的调试,对此的任何意见都将不胜感激

更新:

当我将它发布到一个新Web角色的两个实例时,我实际上已经开始工作了。我将开始进行部署,看看是否可以发现任何差异

更新2:


区别在于,我的项目使用的是
Microsoft.ApplicationServer.Caching.Client.dll和
Microsoft.ApplicationServer.Caching.Core.dll的
1.0.4621.0
,而微软的项目使用的是
1.0.4655.0
。所以实际上可能是我使用的是旧版本的SDK。出于某种原因,我的项目坚持在我发布时上载这些文件,即使我删除了它们,但如果这解决了问题,我会给出完整的答案。

尝试将最新的Azure SDK升级到1.7 SP11.8<代码>自动发现
仅在的Azure SDK 1.7.1+中受支持

(2011年11月)组件版本:
1.0.4617.0

(2012年6月)组件版本:
1.0.4621.0

(2012年6月SP1)汇编版本:
1.0.4655.0


(2012年10月)汇编版本:
1.0.4797.0

谢谢!正如你所建议的,我通过升级到1.8绕过了这个异常。不幸的是,那个版本导致了另一个异常,但我将把它作为另一个问题一起发布,以防我无法解决它。谢谢