IIS Compilation Error -2146232576 AspNetInitializationExceptionModule

后端 未结 9 728
执笔经年
执笔经年 2020-12-05 07:35

I have a fairly simple C# WebAPI2 project that runs locally but after publishing to IIS on a remote machine (Windows Server 2012 R2 Standard) the web page displays the follo

9条回答
  •  渐次进展
    2020-12-05 07:56

    For me, it was because i tried to build a string for the Roles property of the attribute Authorize on my class.

    [Authorize(Roles = IdentityRoles.Administrator + "," + IdentityRoles.BaseData)]
    

    I had to build the different strings and just set one constant to Roles:

    [Authorize(Roles = IdentityRoles.AutorizationStrings.AdminBaseData)]
    

    where

    IdentityRoles.AutorizationStrings.AdminBaseData = "Administrator,Base data";
    

    Hope this helps anybody that tricks themself down this hole.

提交回复
热议问题