Search code examples
c#.netweb-servicesvisual-studioodata

Server Error in '/' Application ()


I created a OData ADO.NET Framework web api which I am testing in localhost and am getting the error enter image description here

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

The StackTrace is:

[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

How should I remove this error ? Thanks a lot.

My web.config has:

  <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>

Solution

  • The process for removing bindings(Team Foundation Service - tfs) is simple:

    Ensure you don’t have the solution/projects open in Visual Studio Copy your solution to a new directory (because the tool does modify files)

    Run the utility from the command line: VSUnbindSourceControl.exe d:\mysolution folder

    Once the tool is finished, all the source control bindings have been removed from any solution and project files.

    Also have a look at this SO post