iisnode icon indicating copy to clipboard operation
iisnode copied to clipboard

500 - Internal server error, if handlers in web.config

Open xscav opened this issue 12 years ago • 24 comments

Windows Server Core 2008 R2 Datacenter x64 IIS 7.5 iisnode-full-iis7-v0.1.19.0-x64.msi

500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.

So, in detail.

When i try open a page, placed in a folder, where there is a file 'web.config', with ', i'm get an error.

F.E.:

server/node - Successfull (there is no web.config in this folder) server/node/helloworld/readme.htm - 500 error , because of web.config:

<configuration>
  <system.webServer>

    <handlers>
      <add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
    </handlers>

  </system.webServer>
</configuration>

If i change web.config to :

<configuration>
  <system.webServer>

    <handlers>
    </handlers>

  </system.webServer>
</configuration>

then the same error, but if i change it to:

<configuration>
  <system.webServer>

  </system.webServer>
</configuration>

or even to:

<configuration>
  <system.webServer>

    <rewrite>
      <rules>
        <rule name="myapp">
          <match url="myapp/*" />
          <action type="Rewrite" url="hello.js" />
        </rule>
      </rules>
    </rewrite>

  </system.webServer>
</configuration>

then all files browses normal, but as a static content.

xscav avatar Jun 09 '12 21:06 xscav

Does IIS provide more information about the error or the module that failed when you try to access the URL locally (http://localhost/...)?

tjanczuk avatar Jun 11 '12 16:06 tjanczuk

not locally, from local network. "server" - local name of server. Where can i see more information?

xscav avatar Jun 11 '12 16:06 xscav

Oh, there is an error in an issue. not 505 error, 500

//fixed

there is only 2 interesting strings in inetpub\logs\LogFiles\W3SVC1

#Fields: date time cs-method cs-uri-stem cs-uri-query s-port cs-version cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken 2012-06-10 20:23:20 GET /node/helloworld/readme.htm - 80 HTTP/1.1 server 500 19 33 1357 445 484 2012-06-10 20:24:54 GET /node/logging/readme.htm - 80 HTTP/1.1 server 500 19 33 1357 442 109

xscav avatar Jun 11 '12 16:06 xscav

Have you run %programfiles%\iisnode\setupsamples.bat from an administrative command prompt before accessing the samples?

Can you try collecting the ETW traces using the instructions at http://tomasz.janczuk.org/2011/09/using-event-tracing-for-windows-to.html?

tjanczuk avatar Jun 11 '12 17:06 tjanczuk

yes, samples are at those places, yes, from an administrative cmd. What's about tracing,

I tried to browse server/node/helloworld/readme.html:

<Events>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    <System>
        <Provider Guid="{9e814aad-3204-11d2-9a82-006008a86939}" />
        <EventID>0</EventID>
        <Version>2</Version>
        <Level>0</Level>
        <Task>0</Task>
        <Opcode>0</Opcode>
        <Keywords>0x0</Keywords>
        <TimeCreated SystemTime="2012-06-11T22:33:05.250000000Z" />
        <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
        <Execution ProcessID="2580" ThreadID="2548" ProcessorID="0" KernelTime="15" UserTime="0" />
        <Channel />
        <Computer />
    </System>
    <EventData>
        <Data Name="BufferSize">    8192</Data>
        <Data Name="Version">83951878</Data>
        <Data Name="ProviderVersion">    7601</Data>
        <Data Name="NumberOfProcessors">       1</Data>
        <Data Name="EndTime">129839132095312500</Data>
        <Data Name="TimerResolution">  156250</Data>
        <Data Name="MaxFileSize">       0</Data>
        <Data Name="LogFileMode">0x0</Data>
        <Data Name="BuffersWritten">       1</Data>
        <Data Name="StartBuffers">       1</Data>
        <Data Name="PointerSize">       8</Data>
        <Data Name="EventsLost">       0</Data>
        <Data Name="CPUSpeed">    2010</Data>
        <Data Name="LoggerName">0x2</Data>
        <Data Name="LogFileName">0x3</Data>
        <Data Name="BootTime">129839028755000000</Data>
        <Data Name="PerfFreq">3579545</Data>
        <Data Name="StartTime">129839131852500000</Data>
        <Data Name="ReservedFlags">0x1</Data>
        <Data Name="BuffersLost">       0</Data>
        <Data Name="SessionNameString">iisnode</Data>
        <Data Name="LogFileNameString">C:\Users\ADMINI~1\AppData\Local\Temp\iisnode.etl</Data>
    </EventData>
    <RenderingInfo Culture="en-US">
        <Opcode>Header</Opcode>
        <Provider>MSNT_SystemTrace</Provider>
        <EventName xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">EventTrace</EventName>
    </RenderingInfo>
    <ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
        <EventGuid>{68fdd900-4a3e-11d1-84f4-0000f80464e3}</EventGuid>
    </ExtendedTracingInfo>
</Event>
</Events>

xscav avatar Jun 11 '12 18:06 xscav

Can you try capturing ETW while browsing to server/node/helloworld/hello.js?

tjanczuk avatar Jun 11 '12 21:06 tjanczuk

The same, i think.:

<Events>
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
    <Provider Guid="{9e814aad-3204-11d2-9a82-006008a86939}" />
    <EventID>0</EventID>
    <Version>2</Version>
    <Level>0</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x0</Keywords>
    <TimeCreated SystemTime="2012-06-12T04:10:59.078125000Z" />
    <Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
    <Execution ProcessID="884" ThreadID="1300" ProcessorID="0" KernelTime="15" UserTime="0" />
    <Channel />
    <Computer />
</System>
<EventData>
    <Data Name="BufferSize">    8192</Data>
    <Data Name="Version">83951878</Data>
    <Data Name="ProviderVersion">    7601</Data>
    <Data Name="NumberOfProcessors">       1</Data>
    <Data Name="EndTime">129839334762656250</Data>
    <Data Name="TimerResolution">  156250</Data>
    <Data Name="MaxFileSize">       0</Data>
    <Data Name="LogFileMode">0x0</Data>
    <Data Name="BuffersWritten">       1</Data>
    <Data Name="StartBuffers">       1</Data>
    <Data Name="PointerSize">       8</Data>
    <Data Name="EventsLost">       0</Data>
    <Data Name="CPUSpeed">    2010</Data>
    <Data Name="LoggerName">0x2</Data>
    <Data Name="LogFileName">0x3</Data>
    <Data Name="BootTime">129839028755000000</Data>
    <Data Name="PerfFreq">3579545</Data>
    <Data Name="StartTime">129839334590781250</Data>
    <Data Name="ReservedFlags">0x1</Data>
    <Data Name="BuffersLost">       0</Data>
    <Data Name="SessionNameString">iisnode</Data>
    <Data Name="LogFileNameString">C:\Users\ADMINI~1\AppData\Local\Temp\iisnode.etl</Data>
</EventData>
<RenderingInfo Culture="en-US">
    <Opcode>Header</Opcode>
    <Provider>MSNT_SystemTrace</Provider>
    <EventName xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">EventTrace</EventName>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
    <EventGuid>{68fdd900-4a3e-11d1-84f4-0000f80464e3}</EventGuid>
</ExtendedTracingInfo>

xscav avatar Jun 12 '12 00:06 xscav

Need i install some packages to successfull tracing?

xscav avatar Jun 12 '12 00:06 xscav

No, that should not be necessary


From: Evgeny Sent: 6/11/2012 5:14 PM To: Tomasz Janczuk Subject: Re: [iisnode] 500 - Internal server error, if handlers in web.config (#172)

Need i install some packages to successfull tracing?


Reply to this email directly or view it on GitHub: https://github.com/tjanczuk/iisnode/issues/172#issuecomment-6259882

tjanczuk avatar Jun 12 '12 00:06 tjanczuk

Actually can you first check one aspect of your IIS configuration? Through IIS Manager, can you open up the properties of the application pool that is associated with the iisnode samples (DefaultAppPool) and verify the value of the "Enable 32 bit applications"? It should be set to "false". If it is set to "true" it may explain the behavior you are seeing.

tjanczuk avatar Jun 12 '12 04:06 tjanczuk

Enable 32 bit applications (defaultAppPool) - false. App pool for node app, and Default Web site - defaultAppPool; iisnode_schema in its place, and there are strings in applicationHost.config:

        <section name="iisnode" />

....

                <virtualDirectory path="/" physicalPath="C:\Program Files\iisnode\www" userName="" />

...

        <add name="iisnode" image="C:\Program Files\iisnode\iisnode.dll" preCondition="bitness64" />

...

        <add name="iisnode" preCondition="bitness64" />

xscav avatar Jun 12 '12 11:06 xscav

I'm using templates from WebMatrix and the same error occurs.

I'm using IIS Express 7.5 and IIS doesn't present much of an error trace. It only tells

iisnode
ExecuteRequestHandler
error code 0x000003eb

something like that

When i copy the exactly same code to some where else (other than the default folder of my sites, which is "D:\我的资料库\Documents\My Web Sites") and then import the site in "Sites from folders", the errors disappeared.

My guess this issue could have something to do with the Unicode characters in the path of the site.

CarlLee avatar Jun 18 '12 08:06 CarlLee

I have further tested my assumption, it turns out I might just be right.

I renamed folder containing the copied code into a Chinese name, and reopen and rerun it with WebMatrix 2, it crashed again (it works OK before I change the name of the folder)

CarlLee avatar Jun 18 '12 08:06 CarlLee

Mine is "D:\myworks\node\test" , there is no Chinese character.

EthanZhu avatar Jul 11 '12 10:07 EthanZhu

I've seen a similar error. When attempting to use iisnode on a server without ASP.NET installed, the HTTP response was indicating the 'handlers' section of web.config was locked at a parent level, like this: http://support.microsoft.com/kb/942055.

After installing ASP.NET, whatever it does, it allows the 'handlers' section to be overwritten, and everything works.

I've made a pull request, to update the readme: https://github.com/tjanczuk/iisnode/pull/210

pmanijak avatar Sep 11 '12 06:09 pmanijak

+1

futurechan avatar Mar 31 '14 14:03 futurechan

I hit this error as well on Windows Server 2012 with IIS 8. We only had Classic ASP installed on the server, not ASP.NET. But it was an easy enough fix once I found this issue.

dpolivy avatar May 13 '14 00:05 dpolivy

Saved my butt +1

waryfool avatar Jun 19 '15 20:06 waryfool

Still always facing same issue while deploying iisnode on Windows 2016, and every time this post helps :) Just install ASP.NET

gusarov avatar Nov 23 '17 09:11 gusarov

For those that bump into this and want to fix this without installing asp.net:

This is caused by the default IIS config that overriding the handlers section in web.config is not allowed. You can change this by editing the file applicationHost.config (in C:\Windows\System32\inetsrv\config).

You find the line <section name="handlers" overrideModeDefault="Deny" />

And change it to <section name="handlers" overrideModeDefault="Allow" />

steffest avatar Mar 27 '18 14:03 steffest

overrideModeDefault="Allow" " worked for me. Thank You!

hrachG87 avatar Apr 25 '18 19:04 hrachG87

Thanks @steffest , overrideModeDefault="Allow" " worked for me too !!

prolitiks avatar Sep 01 '18 12:09 prolitiks

@steffest Thanks. Your solution worked for me.

alihesari avatar Jan 31 '19 13:01 alihesari

This issue is occurring for me on an Azure AppService. On localhost I managed to get the app running by using the Feature Delegation option in IIS manager, but on Azure I don't have this option. When using Kudu console to navigate to C:\Windows[System32|SysWOW64]\inetsrv\config, then access is denied to the \config folder.

When I remove the line <add name="iisnode" ... /> from /system.webServer/handlers/ in web.config, then the app serves my serverside js file as plaintext to the browser. But this does indicate the handler is the offending line, because with it I get the aforementioned 500.1002 error pointing to an invalid web.config.

Strange thing is this used to work up until about April 30. Reverting back to previous versions of the JS app has had no effect. I have also deleted and re-created the AppService.

What can I do to get this working on Azure App Service?

simmetric avatar May 08 '19 09:05 simmetric