“/”应用程序 () 中的服务器错误

Server Error in '/' Application ()

我创建了一个 OData ADO.NET Framework web api,我正在本地主机上测试它并收到错误

Line 19:             if (!EventLog.SourceExists("MyService"))

StackTrace 是:

[SecurityException: The source was not found, but some or all event logs could not be searched.  Inaccessible logs: Security.]
   System.Diagnostics.EventLog.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate) +657
   System.Diagnostics.EventLog.SourceExists(String source, String machineName, Boolean wantToCreate) +104
   System.Diagnostics.EventLog.SourceExists(String source) +14

我该如何消除这个错误?非常感谢。

我的 web.config 有:

  <system.web>
    <authentication mode="Windows">
      <forms requireSSL="true" />
    </authentication>
    <authorization>
      <allow roles="MyService" />
      <deny users="*" />
    </authorization>



    <httpCookies requireSSL="true" httpOnlyCookies="true" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" enableVersionHeader="false"/>
  </system.web>

删除绑定(Team Foundation Service - tfs)的过程很简单:

确保您没有在 Visual Studio 中打开 solution/projects 将您的解决方案复制到新目录(因为该工具会修改文件)

运行 来自命令行的实用程序:VSUnbindSourceControl.exe d:\mysolution folder

工具完成后,所有源代码管理绑定都已从任何解决方案和项目文件中删除。

也看看this SO post