运行时策略不允许执行名为“glimpse_config”的资源

Med*_*tor 5 glimpse asp.net-web-api2

我尝试将 glipse 添加到 webapi 项目,但总是收到错误“运行时策略不允许执行名为“glimpse_config”的资源。”

我该如何解决它?如何禁用此策略?

Cia*_*her 1

在 Web 应用程序项目内的 web.config 文件中,确保将以下设置添加到“configuration”XML 元素下的某处,即

<configuration>
....other config

<glimpse defaultRuntimePolicy="On" endpointBaseUri="~/Glimpse.axd"></glimpse>

</configuration>
Run Code Online (Sandbox Code Playgroud)

如果您还没有以下命名空间引用,则还需要将其放置在“configSections”元素中:

<configuration>
  <configSections>
      ... other config
      <section name="glimpse" type="Glimpse.Core.Configuration.Section, Glimpse.Core" />
  </configSections>
</configuration>
Run Code Online (Sandbox Code Playgroud)