天蓝色项目出错

时间:2014-09-08 07:53:36

标签: c# azure

我在TFS中有一个Azure项目,以前工作得很好。

我刚刚获得最新版本并重建了项目,现在我遇到了一些错误:

Error   97  The setting 'Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel' for role ServiceLayer is specified in the service configuration file, but it is not declared in the service definition file. D:\...\ServiceLayer.Azure1\ServiceConfiguration.Local.cscfg 1   1   ServiceLayer.Azure1

Error   98  Role: 'ServiceLayer', setting 'Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel' in all service configurations could not be found in the service definition.    D:\...\ServiceLayer.Azure1\ServiceDefinition.csdef

我有以下代码:

ServiceDefinition.csdef中:

<ServiceDefinition name="ServiceLayer.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">
  <WebRole name="ServiceLayer" vmsize="Medium">
    <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" />
    </Imports>
  </WebRole>
</ServiceDefinition>

和文件:ServiceConfiguration.Local.cscfg:

<ServiceConfiguration serviceName="ServiceLayer.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2014-01.2.3">
  <Role name="ServiceLayer">
    <Instances count="1" />
    <ConfigurationSettings>
      <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountUsername" value="[...]" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountEncryptedPassword" value="[...]" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.AccountExpiration" value="2015-03-05T23:59:59.0000000+01:00" />
      <Setting name="Microsoft.WindowsAzure.Plugins.RemoteForwarder.Enabled" value="true" />
      <Setting name="Microsoft.WindowsAzure.Plugins.Caching.ClientDiagnosticLevel" value="1" />
    </ConfigurationSettings>
    <Certificates>
      <Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="A218B66C70E780B00E189FAF7C75B0696B90D284" thumbprintAlgorithm="sha1" />
    </Certificates>
  </Role>
</ServiceConfiguration>

2 个答案:

答案 0 :(得分:21)

您还需要在ConfigurationSettings部分的服务定义文件中指定所有设置名称(不带值)。

所以你的ServiceDefinitionFile应该是这样的:

<ServiceDefinition name="ServiceLayer.Azure1"     xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2014-01.2.3">


 <WebRole name="ServiceLayer" vmsize="Medium">
<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" />
</Imports>

  <ConfigurationSettings>
  <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" />
  <Setting name="Microsoft.WindowsAzure.Plugins.RemoteAccess.Enabled" /> 

     .... and so on (all your settings here

  </ConfigurationSettings>
   </WebRole>
  </ServiceDefinition>

编辑:

您需要为Certificates部分做同样的事情。

答案 1 :(得分:0)

还请注意大小写很重要。我有相同的错误消息,在我的情况下,这是由于使用

引起的
<Setting Name="mysetting" value="myvalue" />

代替

<Setting name="mysetting" value="myvalue" />