IISNode debugger: Error during WebSocket handshake: Unexpected response code: 200 - node.js

I've been having trouble getting the IISNode debugger to work with my project. I figured I'd start by getting it working with the example projects first but I'm still not having any luck. Using IISNode 0.2.21 and node.js 8.11.2 with IIS 10.0.14393.0.
When I try to open the debugger the entire process takes around 3 minutes and eventually fails with "WebSocket connection to 'ws://localhost/node/configuration/hello.js/debug/ws' failed: Error during WebSocket handshake: Unexpected response code: 200". See screenshot:
The web.config file found at c:\Program Files\iisnode\www\configuration\ reads as follows:
<configuration>
<system.webServer>
<!-- indicates that the hello.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="hello.js" verb="*" modules="iisnode" />
</handlers>
<!--
the iisnode section configures the behavior of the node.js IIS module
setting values below are defaults
* node_env - determines the environment (production, development, staging, ...) in which
child node processes run; if nonempty, is propagated to the child node processes as their NODE_ENV
environment variable; the default is the value of the IIS worker process'es NODE_ENV
environment variable
* nodeProcessCommandLine - command line starting the node executable; in shared
hosting environments this setting would typically be locked at the machine scope.
* interceptor - fully qualified file name of a node.js application that will run instead of an actual application
the request targets; the fully qualified file name of the actual application file is provided as the first parameter
to the interceptor application; default interceptor supports iisnode logging
* nodeProcessCountPerApplication - number of node.exe processes that IIS will start per application;
setting this value to 0 results in creating one node.exe process per each processor on the machine
* maxConcurrentRequestsPerProcess - maximum number of reqeusts one node process can
handle at a time
* maxNamedPipeConnectionRetry - number of times IIS will retry to establish a named pipe connection with a
node process in order to send a new HTTP request
* namedPipeConnectionRetryDelay - delay in milliseconds between connection retries
* maxNamedPipeConnectionPoolSize - maximum number of named pipe connections that will be kept in a connection pool;
connection pooling helps improve the performance of applications that process a large number of short lived HTTP requests
* maxNamedPipePooledConnectionAge - age of a pooled connection in milliseconds after which the connection is not reused for
subsequent requests
* asyncCompletionThreadCount - size of the IO thread pool maintained by the IIS module to process asynchronous IO; setting it
to 0 (default) results in creating one thread per each processor on the machine
* initialRequestBufferSize - initial size in bytes of a memory buffer allocated for a new HTTP request
* maxRequestBufferSize - maximum size in bytes of a memory buffer allocated per request; this is a hard limit of
the serialized form of HTTP request or response headers block
* watchedFiles - semi-colon separated list of files that will be watched for changes; a change to a file causes the application to recycle;
each entry consists of an optional directory name plus required file name which are relative to the directory where the main application entry point
is located; wild cards are allowed in the file name portion only; for example: "*.js;node_modules\foo\lib\options.json;app_data\*.config.json"
* uncFileChangesPollingInterval - applications are recycled when the underlying *.js file is modified; if the file resides
on a UNC share, the only reliable way to detect such modifications is to periodically poll for them; this setting
controls the polling interval
* gracefulShutdownTimeout - when a node.js file is modified, all node processes handling running this application are recycled;
this setting controls the time (in milliseconds) given for currently active requests to gracefully finish before the
process is terminated; during this time, all new requests are already dispatched to a new node process based on the fresh version
of the application
* loggingEnabled - controls whether stdout and stderr streams from node processes are captured and made available over HTTP
* logDirectory - directory name relative to the main application file that will store files with stdout and stderr captures;
individual log file names have unique file names; log files are created lazily (i.e. when the process actually writes something
to stdout or stderr); an HTML index of all log files is also maintained as index.html in that directory;
by default, if your application is at http://foo.com/bar.js, logs will be accessible at http://foo.com/iisnode;
SECURITY NOTE: if log files contain sensitive information, this setting should be modified to contain enough entropy to be considered
cryptographically secure; in most situations, a GUID is sufficient
* debuggingEnabled - controls whether the built-in debugger is available
* debuggerPortRange - range of TCP ports that can be used for communication between the node-inspector debugger and the debugee; iisnode
will round robin through this port range for subsequent debugging sessions and pick the next available (free) port to use from the range
* debuggerPathSegment - URL path segment used to access the built-in node-inspector debugger; given a node.js application at
http://foo.com/bar/baz.js, the debugger can be accessed at http://foo.com/bar/baz.js/{debuggerPathSegment}, by default
http://foo.com/bar/baz.js/debug
* debugHeaderEnabled - boolean indicating whether iisnode should attach the iisnode-debug HTTP response header with
diagnostics information to all responses
* maxLogFileSizeInKB - maximum size of a single log file in KB; once a log file exceeds this limit a new log file is created
* maxTotalLogFileSizeInKB - maximum total size of all log files in the logDirectory; once exceeded, old log files are removed
* maxLogFiles - maximum number of log files in the logDirectory; once exceeded, old log files are removed
* devErrorsEnabled - controls how much information is sent back in the HTTP response to the browser when an error occurrs in iisnode;
when true, error conditions in iisnode result in HTTP 200 response with the body containing error details; when false,
iisnode will return generic HTTP 5xx responses
* flushResponse - controls whether each HTTP response body chunk is immediately flushed by iisnode; flushing each body chunk incurs
CPU cost but may improve latency in streaming scenarios
* enableXFF - controls whether iisnode adds or modifies the X-Forwarded-For request HTTP header with the IP address of the remote host
* promoteServerVars - comma delimited list of IIS server variables that will be propagated to the node.exe process in the form of
x-iisnode-<server_variable_name> HTTP request headers; for a list of IIS server variables available see
http://msdn.microsoft.com/en-us/library/ms524602(v=vs.90).aspx; for example "AUTH_USER,AUTH_TYPE"
* configOverrides - optional file name containing overrides of configuration settings of the iisnode section of web.config;
the format of the file is a small subset of YAML: each setting is represented as a <key>: <value> on a separate line
and comments start with # until the end of the line, e.g.
# This is a sample iisnode.yml file
nodeProcessCountPerApplication: 2
maxRequestBufferSize: 8192 # increasing from the default
# maxConcurrentRequestsPerProcess: 512 - commented out setting
-->
<iisnode
node_env="%node_env%"
nodeProcessCountPerApplication="1"
maxConcurrentRequestsPerProcess="1024"
maxNamedPipeConnectionRetry="100"
namedPipeConnectionRetryDelay="250"
maxNamedPipeConnectionPoolSize="512"
maxNamedPipePooledConnectionAge="30000"
asyncCompletionThreadCount="0"
initialRequestBufferSize="4096"
maxRequestBufferSize="65536"
watchedFiles="*.js;iisnode.yml"
uncFileChangesPollingInterval="5000"
gracefulShutdownTimeout="60000"
loggingEnabled="true"
logDirectory="iisnode"
debuggingEnabled="true"
debugHeaderEnabled="false"
debuggerPortRange="5058-6058"
debuggerPathSegment="debug"
maxLogFileSizeInKB="128"
maxTotalLogFileSizeInKB="1024"
maxLogFiles="20"
devErrorsEnabled="true"
flushResponse="false"
enableXFF="false"
promoteServerVars=""
configOverrides="iisnode.yml"
/>
<!--
One more setting that can be modified is the path to the node.exe executable and the interceptor:
<iisnode
nodeProcessCommandLine=""%programfiles%\nodejs\node.exe""
interceptor=""%programfiles%\iisnode\interceptor.js"" />
-->
</system.webServer>
</configuration>
I've read that permissions can be an issue so I tried granting full access to IIS_IUSRS, DefaultAppPool, and Everyone but still hasn't helped.
I've also tried disabling websockets in web.config but that hasn't helped either.
<system.webServer>
<webSocket enabled="false" />
...
</system.webserver>
I feel like I'm so close to getting this to work but I'm missing one small piece. Any ideas? I've tried every link and forum post I could find and they all suggest doing the things I've listed above but to no avail.
Your help is greatly appreciated.
Thanks.

Related

IIS loghttp module spams EventLog with errors about a worker process which cannot obtain custom log data for N requests

we have setup our web application on a new Windows Server Datacenter 2019 edition.
Previously it ran on a Windows 2008 server.
The application runs smoothly, but the EventLog is being overflooded with these errors:
The loghttp module in the worker process with id '13104' could not obtain custom log data for '1' requests. The data field contains the error code.
The loghttp module in the worker process with id '11500' could not obtain custom log data for '1' requests. The data field contains the error code.
The loghttp module in the worker process with id '13536' could not obtain custom log data for '1' requests. The data field contains the error code.
We have a bunch of AppPools running, but the errors only comes in relation to 3 of them.
The relevant ones are identified via the worker process id, see below screendump.
Pattern, logs every minutes
If I stop the IIS Logging Module the EventLogs also stops.
There are no Custom Fields being logged.
The Logging module is using w3c-format with only Standard fields added.
C:\Windows\System32\LogFiles\HTTPERR shows nothing besides lines like this:
2021-11-02 09:10:58 10.217.24.201 34241 10.217.10.240 443 - - - - - - Timer_ConnectionIdle -
2021-11-02 09:10:58 10.217.24.201 5601 10.217.10.240 443 - - - - - - Timer_ConnectionIdle -
IIS Logs are being written to file OK.
There is a pattern in the log, so every minute the same 5-6 EventLogs-lines are written
Pattern with logs every minute

VS2019-project is unloaded, csproj <UseIISExpress> was changed somehow,

I had a problem and dell premium support ran some kind of upgrade or re-install of windows 10 while keeping my files in tack.
The next day, I was working on my MVC project in VS and it loaded ok and debugging got my application to the login page, which means it had to successfully read the Entity Framework Context with LINQ type stuff, and all of a sudden my project started having these errors about reading Entity Framework Context, but only in one method.
Then things got worse, I first tried to close VS and reopen VS. But this time, it said my project had been unloaded. I tried the option to reload the project, but now I was getting errors about "the operation could not be completed. the system cannot find the path specified" and errors having to do with not being able to find the current file highlighted at the top of the VS editor.
After looking up the unload issues in forums, I saw a suggestion to call up my Mbsa.csproj and change to false and to True. Then my project loaded ok - but why did this change? it was always false in my previous backups.
Then , when trying to run my project with VS Debugging, I started getting connection messages like these:
1 - C:\MBSSys\Mbsa\Mbsa 2020\Mbsa.csproj : error : The Web Application Project Mbsa is configured to use IIS. The Web server 'http://localhost:51700/' could not be found.
2 -The connection to 'localhost' failed.
Error: ConnectionRefused (0x274d).
System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:51712
3 - HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Detailed Error Information:
Module IIS Web Core
Notification BeginRequest
Handler Not yet determined
Error Code 0x80070021
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File \?\D:\MBSSys\Mbsa\Mbsa 2020\web.config
Requested URL http://localhost:51700/
Physical Path D:\MBSSys\Mbsa\Mbsa 2020
Logon Method Not yet determined
Logon User Not yet determined
Config Source:
163: <validation validateIntegratedModeConfiguration="false" />
164: <handlers>
165: <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
4 - Error message:
Server Error in Application "application name"
HTTP Error 500.19 – Internal Server Error
HRESULT: 0x80070021
Description of HRESULT
The requested page cannot be accessed because the related configuration data for the page is invalid.
Cause for HResult code 0x80070021
This problem can occur when the specified portion of the IIS configuration file is locked at a higher configuration level.
Resolution for HResult code 0x80070021
To resolve this problem, unlock the specified section, or do not use it at that level. For more information on configuration locking, see How to Use Locking in IIS 7.0 Configuration.
So I am wondering if anyone else has faced this particular issue,
or, if anyone can give me any appreciated advice here.
Thanks for your time and advice. If you need more clues, just ask.
The seems to happen after installing KB4568831.
https://superuser.com/questions/1575295/windows-updates-kb4568831-kb4562899-break-all-net-applications-hosted-in-iis
I could get rid of the 500.19 errors by manually re-installing some optional windows features that the update apparently removes (see below), but after I got auth-related errors instead. In the end I rolled back KB4568831 to resolve the issue for the time being. Hopefully this gets fixed soon.

Connection configuration loops - Prosys OPC UA Client

I'm using sample codes from documentation and I'm trying to connect to server using Prosys OPC UA Client. I have tried opcua-commander and integration objects opc ua client and it looks like server works just fine.
Here's what is happening:
After entering endpointUrl, client adds to url -- urn:NodeOPCUA-Server-default.
Client asks to specify security settings.
Client asks to choose server - only 1 option and it's urn:NodeOPCUA-Server-default.
And it goes back to step 2 and 3 over and over.
If I just minimize prosys client without closing configuration after some time I get this info in terminal:
Server: closing SESSION new ProsysOpcUaClient Session15 because of timeout = 300000 has expired without a keep alive
\x1B[46mchannel = \x1B[49m ::ffff:10.10.13.2 port = 51824
I have tried this project and it works -> node-opcua-htmlpanel. What's missing in sample code then?
After opening debugger I have noticed that each Time I select security settings and hit OK, server_publish_engine reports:
server_publish_engine:179 Cencelling pending PublishRequest with statusCode BadSecureChannelClosed (0x80860000) length = 0
This is due to a specific interoperability issue that was introduced in node-opcua#0.2.2. this will be fixed in next version of node-opcua. The resolution can be tracked here https://github.com/node-opcua/node-opcua/issues/464
The issue has been handled at the Prosys OPC Forum:
The error happens because the server sends different
EndpointDescriptions in GetEndpointsResponse and
CreateSessionResponse.
In GetEndpoints, the returned EndpointDescriptions contain
TransportProfileUri=http://opcfoundation.org/UA-Profile/Transport/uatcp-uasc-uabinary.
In CreateSessionResponse, the corresponding TransportProfileUri is
empty.
In principle, the server application is not working according to
specification. The part 4 of the OPC UA specification states that “The
Server shall return a set of EndpointDescriptions available for the
serverUri specified in the request. … The Client shall verify this
list with the list from a DiscoveryEndpoint if it used a
DiscoveryEndpoint to fetch the EndpointDescriptions. It is recommended
that Servers only include the server.applicationUri, endpointUrl,
securityMode, securityPolicyUri, userIdentityTokens,
transportProfileUri and securityLevel with all other parameters set to
null. Only the recommended parameters shall be verified by the
client.”

Mule ESB: Retrieving email messages from Gmail using IMAP connector

I am new to Mule and im trying to create a Mule configuration that pulls sent emails from a GMail account via imap and pushes them to a php script that processes and stores them in a custom CRM that i've built.
For starters, i'm just trying to get the inbox emails dumped into a text files and i plan to work from there.
As new messages are received by the mailbox, Mule should pick up the new messages and process them automatically.
The Mule config looks like this so far:
<imaps:connector name="IMAP" mailboxFolder="INBOX" validateConnections="false" doc:name="IMAP" />
<flow name="flows1Flow1" doc:name="flows1Flow1">
<imaps:inbound-endpoint host="imap.gmail.com" port="993" user="[[username]]%40gmail.com" password="[[password]]" connector-ref="IMAP" doc:name="IMAP"/>
<file:outbound-endpoint path="D:\mailflow" outputPattern="msg_#[function:date].txt" doc:name="File"/>
</flow>
The program runs and gets to this point:
INFO 2012-01-12 13:51:06,606 [main] org.mule.DefaultMuleContext:
**********************************************************************
* Application: mailflow *
* OS encoding: Cp1252, Mule encoding: UTF-8 *
* *
* Agents Running: *
* JMX Agent *
**********************************************************************
INFO 2012-01-12 13:51:06,606 [main] org.mule.module.launcher.DeploymentService:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ Started app 'mailflow' +
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
And then just sits there indefinitely, doing nothing?!
There is documentation suggesting that because i'm using IMAPS i need to add a TLS client and TLS key store to the imaps connector. I'm not sure what these are or how to use them though and the documentation is highly specialized and hard to understand.
I'm also not sure that that's what the problem is in the first place as the app doesn't crash at any point.
Has anyone had success creating an imap flow with GMail?
Please Help?!
Just create the connector like this:
<imaps:connector name="IMAP">
<imaps:tls-client/>
<imaps:tls-trust-store/>
</imaps:connector>
And that should do the trick.
Also, I'd remove the "#gmail" from the user's definition, since it's not necessary.
Bye!
German
just put in a * and you wont see the error and will still work fine.
<imaps:tls-client path="*" storePassword="*"/>
<imaps:tls-trust-store path="*" storePassword="*"/>
You have to change imap:connector and imap:inbound-endpoint to imaps:connector and imaps:inbound-endpoint.
It is working fine for me. I have the same issued and now it is fixed with this little change.
Only non-deleted and unread messages are dispatched as messages (RetrieveMessageReceiver.java:148 and 149)
if (!messages[i].getFlags().contains(Flags.Flag.DELETED)
&& !messages[i].getFlags().contains(Flags.Flag.SEEN))
If the folder is big, it will take some time (potentially even hours) to get to the point to process unread messages.
Settings for the IMAP
Use the app password
https://security.google.com/settings/security/apppasswords
and finally use the correct path for the mail to be saved.

classic .net app pool + iis 7.5 + compression modules

I have windows 2008 r2 installed on my server, so iis 7.5 is.
I am not able run any of the class.net applications on iis. one of the compression modules throws exception.
Detailed Error Information
Module DynamicCompressionModule
Notification SendResponse
Handler StaticFile
Error Code 0x8007007e
Requested URL http://localhost:8081/a.html
Physical Path C:\inetpub\TestWebSite\a.html
Logon Method Anonymous
Logon User Anonymous
i tried diferent logon methods, different sites even static html pages are not served. Error never changes.
sorry for poor english.
A quick bit of searching found this: http://forums.iis.net/t/1149768.aspx. Are you running a 64bit server? If so, is it possible you are (potentially inadvertently) mixing 32bit and 64bit code in the same application pool?
More information with slightly more detailed steps to resolve the problem found here: http://blogs.msdn.com/webtopics/archive/2010/03/08/troubleshooting-http-500-19-errors-in-iis-7.aspx (search down for error code 0x8007007e)
Error Message:
HTTP Error 500.19 - Internal Server
Error The requested page cannot be
accessed because the related
configuration data for the page is
invalid. Module
DynamicCompressionModule Notification
SendResponse Handler StaticFile
Error Code 0x8007007e Requested URL
http://localhost:80/ Physical Path
C:\inetpub\wwwroot Logon Method
Anonymous Logon User Anonymous
Reason:
Error Code 0x8007007e is:
ERROR_MOD_NOT_FOUND - The specified
module could not be found.
This problem occurs because the
ApplicationHost.config file or the
Web.config file references a module
that is invalid or that does not
exist. To resolve this problem: In the
ApplicationHost.config file or in the
Web.config file, locate the module
reference or the DLL reference that is
invalid, and then fix the reference.
To determine which module reference is
incorrect, enable Failed Request
Tracing, and then reproduce the
problem.
For above specific error (mentioned in
this example),
DynamicCompressionModule module is
causing the trouble. This is because
of the XPress compression scheme
module (suscomp.dll) which gets
installed with WSUS. Since Compression
schemes are defined globally and try
to load in every application Pool, it
will result in this error when 64bit
version of suscomp.dll attempts to
load in an application pool which is
running in 32bit mode.
This module entry looks like:
Hence to get rid of this problem:
Ø Remove/Disable the XPress
compression scheme from the
configuration using the command below:
%windir%\system32\inetsrv\appcmd.exe
set config
-section:system.webServer/httpCompression
/-[name='xpress']
OR
Ø Add an attribute of "precondition=
"64bitness" for this module entry so
that it loads only in 64bit
application pools
Refer this blog for more details on
Preconditions in IIS7
OR
Ø Use a 32bit version of suscomp.dll

Resources