Tôi đang cố gắng để gọi RoleEnvironment.GetConfigurationSetting("SOMEKEY")
như vậy:Tại sao tôi nhận được SEHException khi gọi RoleEnvironment.GetConfigurationSettingValue ("MYKEY")?
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;
}
chính ServiceConfiguration.cscfg của tôi trông như thế này:
<Setting name="CHARGIFY_API_KEY" value="AbCdEfGhIjKlMnOp" />
Và tôi nhận được lỗi này:
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
Trả về 'Marshal.GetExceptionCode()' khi bạn ở trong khối catch cho 'SEHException' là gì? –
Nó trả về "-1066598274" khi gọi 'Marshal.GetExceptionCode()' – Kori
Bạn có chắc là bạn đang chạy dưới Windows Azure? (Dev vải hoặc trong các đám mây thực sự?) – smarx