2016-07-24 11 views
3

Ich habe eine asp.net 4 Anwendung, wo es funktioniert, aber ich kann es nicht für asp.net Kern arbeiten. Die Dokumentation sagt, dass GetSetting in entweder web.config oder app.config Datei aussieht. Speicheremulator ist eingeschaltet.Asp.net Kern CloudConfigurationManager.GetSetting() ist null

public void ConfigureServices(IServiceCollection services) 
{ 
    AzureConfig.Initialize(); 
} 

public static void Initialize() 
{ 
    //Always null 
    var connectionString = CloudConfigurationManager.GetSetting("StorageConnectionString"); 
} 

root web.config-Datei:

<configuration> 
    <appSettings> 
     <add key="StorageConnectionString" value="UseDevelopmentStorage=true;" /> 
    </appSettings> 
</configuration> 

Ich habe diese Abhängigkeiten in meinem project.json:

"Microsoft.WindowsAzure.ConfigurationManager": "3.2.1", 
"WindowsAzure.Storage": "7.1.2", 
"AzureSDK2.2DLLs": "1.0.0" 

bearbeiten, funktioniert das nicht entweder:

{ 
    "ConnectionStrings": { 
    "DefaultConnection": "..." 
    "StorageConnectionString": "UseDevelopmentStorage=true" 
    }, 
    "Logging": { 
    "IncludeScopes": false, 
    "LogLevel": { 
     "Default": "Debug", 
     "System": "Information", 
     "Microsoft": "Information" 
    } 
    }, 
    "StorageConnectionString": "UseDevelopmentStorage=true" 
} 

Antwort

Verwandte Themen