相关疑难解决方法(0)

调用RoleEnvironment.GetConfigurationSettingValue("MYKEY")时为什么会出现SEHException?

我试着RoleEnvironment.GetConfigurationSetting("SOMEKEY")像这样打电话:

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;
}
Run Code Online (Sandbox Code Playgroud)

我的ServiceConfiguration.cscfg键如下所示:

<Setting name="CHARGIFY_API_KEY" value="AbCdEfGhIjKlMnOp" />
Run Code Online (Sandbox Code Playgroud)

我收到这个错误:

异常详细信息:System.Runtime.InteropServices.SEHException:外部组件引发了异常.

[SEHException(0X80004005):外部组件引发的异常.] RoleEnvironmentGetConfigurationSettingValueW(UINT16*,UINT16*,UInt32的,UInt32的*)0 Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetConfigurationSetting(字符串名称,字符串&RET)92微软.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(字符串configurationSettingName)67 ChargifyNET.ChargifyAzurePage.get_Chargify()在C:\ NetProjects\ChargifyDotNET \源\ Chargify.NET\ChargifyAzurePage.cs:26 Chargify.Azure._Default.Page_Load(对象发件人,EventArgs e)在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(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+627

c# azure

38
推荐指数
1
解决办法
2万
查看次数

标签 统计

azure ×1

c# ×1