简体   繁体   中英

Error with azure project

I have an Azure project in TFS that used to work well.

I've just get the latest version and rebuilt the project and now I have some errors:

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

I have the following code:

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>

and the file: 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>

You need to specify all your setting names (without values) also in the Service definition file in the ConfigurationSettings section.

So your ServiceDefinitionFile should look like:

<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>

EDIT:

The same you need to do for your Certificates section.

Also note that casing matters. I had the same error message and in my case it was caused by using

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

instead of

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM