500 -Internal error on web service

asp.netiis-7.5web services

I just recently switched from shared hosting to a vps on GoDaddy. I had a webservice that worked just fine on the shared hosting. I am trying to get it working under my vps. I continually get a 500 – internal error when going to the link.

I did set it up as a application in IIS, and i made its own application pool using integrated pipes.

Any ideas on what else may be causing this issue?

EDIT 1:
If i switch my application pool over to use the same application pool as my site, i get this error instead:
"Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The page must have a <%@ webservice class="MyNamespace.MyClass" … %> directive.

Source Error:

Line 1: This is a marker file generated by the precompilation tool, and should not be deleted!

Source File: /webservices/namesearch.asmx Line: 1 "

Here is my web.config

<?xml version="1.0"?>
<configuration>
  <appSettings/>
  <connectionStrings/>
  <system.web>


 <compilation debug="true" targetFramework="4.0"/>
<!--
  The <authentication> section enables configuration 
  of the security authentication mode used by 
  ASP.NET to identify an incoming user. 
-->
    <authentication mode="Windows"/>
      <customErrors mode="Off"/>

      <!--
       The <customErrors> section enables configuration 
       of what to do if/when an unhandled error occurs 
       during the execution of a request. Specifically, 
       it enables developers to configure html error pages 
       to be displayed in place of a error stack trace.

       <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
         <error statusCode="403" redirect="NoAccess.htm" />
         <error statusCode="404" redirect="FileNotFound.htm" />
       </customErrors>
    -->
    <pages controlRenderingCompatibilityVersion="4.0" clientIDMode="AutoID"/>
  </system.web>
  <!-- 
        The system.webServer section is required for running ASP.NET AJAX under Internet
        Information Services 7.0.  It is not necessary for previous version of IIS.
    -->
</configuration>

EDIT 2:
So i noticed on that parser error it was also saying "Source Error:

Line 1: This is a marker file generated by the precompilation tool, and should not be deleted!"

so i tried to do a precompile on the webservice. When i do this i get the error saying "It is an error to use a section registered as allowDefinition='machinetoapplication' beyond application level. this error can be caused by a virtual directory not being configured as an application in iis"

Best Answer

I just used SoapClient to hit your web service. It allows us to quickly supply arguments to your web service.

Suspect that your error is on NameSearch.asmx.cs:line 29 where you're likely trying to write or read the Event Log (specifically the Security log). Likely EventLog.WriteEntry().

The issue here is that, behind the scenes, your call is trying to VerifyAndCreateSource() without having proper authorization.

To solve this, grant the appropriate permissions to the Security Event Log. Likely the user context running is under NetworkService.

Consider implementing the steps in IIS7: Web Application writing to Event Log generates Security Exception. The main idea here is to allow Network Service, or whatever security context your app is running under, permission to write to the registry key

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog

enter image description here

The full error thrown in your .NET code is:

System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. To create the source, you need permission to read all event logs to make sure that the new source name is unique. Inaccessible logs: Security. at System.Diagnostics.EventLogInternal.FindSourceRegistration(String source, String machineName, Boolean readOnly, Boolean wantToCreate) at System.Diagnostics.EventLogInternal.SourceExists(String source, String machineName, Boolean wantToCreate) at System.Diagnostics.EventLogInternal.VerifyAndCreateSource(String sourceName, String currentMachineName) at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) at System.Diagnostics.EventLog.WriteEntry(String message) at WebServices.NameSearch.GetSearchResult(String prefixText, Int32 count) in C:\Users\xufurisa\Dropbox\Programs\PoliticProfiles\WebServices\NameSearch.asmx.cs:line 29