我嘗試使用IIS Express 7.5(通過WebMatrix)託管的node.js編寫簡單的站點。 我想使用集成Windows身份驗證。使用iisnode和WebMatrix進行Windows身份驗證問題
我配置了applicationhost.config,就像它在一些類似的帖子中描述的那樣。另外我還配置了web.config。
<system.webServer>
<security>
<authentication>
<anonymousAuthentication enabled="false" />
<basicAuthentication enabled="false" />
<windowsAuthentication enabled="true" />
</authentication>
</security>
</system.webServer>
現在,當請求站點時,它要求憑據。現在這很好。然後,我提供了正確的域憑據,並得到了一個錯誤401.1
那麼,在信任區和Fidler的網站說Kerberos門票提供。
怎麼了?
我檢查跟蹤,並得到了以下錯誤:
<EventData>
<Data Name="ContextId">{00000000-0000-0000-3F03-0080000000F8}</Data>
<Data Name="ModuleName">WindowsAuthenticationModule</Data>
<Data Name="Notification">2</Data>
<Data Name="HttpStatus">401</Data>
<Data Name="HttpReason">Unauthorized</Data>
<Data Name="HttpSubStatus">1</Data>
<Data Name="ErrorCode">2147942485</Data>
<Data Name="ConfigExceptionInfo"></Data>
</EventData>
<RenderingInfo Culture="en-US">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">AUTHENTICATE_REQUEST</freb:Description>
<freb:Description Data="ErrorCode">The local device name is already in use. (0x80070055)</freb:Description>
</RenderingInfo>
好了,然後我試圖找出問題的幾個小時,只發現如果刪除規則或從網上URL重寫模塊。配置
<rewrite>
<rules>
<!-- Don't interfere with requests for logs -->
<rule name="LogFile" patternSyntax="ECMAScript" stopProcessing="true">
<match url="^[a-zA-Z0-9_\-]+\.js\.logs\/\d+\.txt$" />
</rule>
<!-- First we consider whether the incoming URL matches a physical file in the /public folder -->
<rule name="StaticContent">
<action type="Rewrite" url="public{REQUEST_URI}" />
</rule>
<!-- All other URLs are mapped to the Node.js application entry point -->
<rule name="DynamicContent">
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
那麼一切都將工作的偉大(除app.js正確處理)
所以,我的問題s如何保留WebMatrix的原始node.js模板並使用Windows身份驗證而不出現此類錯誤?
還有一個問題是如何獲取由node.js中的IIS模塊管道收集的所有上下文信息?