我試圖打電話RoleEnvironment.GetConfigurationSetting("SOMEKEY")
像這樣:爲什麼在調用RoleEnvironment.GetConfigurationSettingValue(「MYKEY」)時收到SEHException?
public partial class AzureBasePage : System.Web.UI.Page
{
protected ChargifyConnect Chargify
{
get {
if (this._chargify == null) {
this._chargify = new ChargifyConnect();
this._chargify.apiKey = RoleEnvironment.GetConfigurationSettingValue("CHARGIFY_API_KEY");
}
return this._chargify;
}
}
private ChargifyConnect _chargify = null;
}
我ServiceConfiguration.cscfg關鍵是這樣的:
<Setting name="CHARGIFY_API_KEY" value="AbCdEfGhIjKlMnOp" />
而且我得到這個錯誤:
Exception Details: System.Runtime.InteropServices.SEHException: External component has thrown an exception.
[SEHException (0x80004005): External component has thrown an exception.] RoleEnvironmentGetConfigurationSettingValueW(UInt16* , UInt16* , UInt32 , UInt32*) +0 Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetConfigurationSetting(String name, String& ret) +92 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +67 ChargifyNET.ChargifyAzurePage.get_Chargify() in C:\NetProjects\ChargifyDotNET\Source\Chargify.NET\ChargifyAzurePage.cs:26 Chargify.Azure._Default.Page_Load(Object sender, EventArgs e) in C:\NetProjects\ChargifyDotNET\Source\Chargify.Azure\Default.aspx.vb:8 System.Web.UI.Control.OnLoad(EventArgs e) +99 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
是什麼'Marshal.GetExceptionCode()'返回,當你在爲'SEHException' catch塊是? – 2010-06-02 13:48:30
它返回「-1066598274」調用'Marshal.GetExceptionCode()的時候' – Kori 2010-06-02 14:35:59
你確定你是在Windows Azure上運行? (開發結構還是真正的雲?) – smarx 2010-06-02 17:17:18