MTConnect.NET-AgentModule-HttpServer implements a server for the MTConnect HTTP REST Protocol for use with the MTConnectAgentApplication class in the MTConnect.NET-Applications-Agents library. Supports MTConnect Versions up to 2.5. Supports .NET Framework 4.6.1 up to .NET 9
$ dotnet add package MTConnect.NET-AgentModule-HttpServer
This Agent Module implements a MTConnect REST Protocol Http server
modules:
- http-server:
hostname: localhost
port: 5000
allowPut: true
indentOutput: true
documentFormat: xml
accept:
text/xml: xml
application/json: json-cppagent
responseCompression:
- gzip
- br
files:
- path: schemas
location: schemas
- path: styles
location: styles
- path: styles/favicon.ico
location: favicon.ico
hostname - The server IP Address or Hostname to bind to.
port - The port number the agent binds to for requests.
accept - Maps HTTP Accept Headers to the corresponding Document Format ID
responseCompression - Sets the List of Encodings (ex. gzip, br, deflate) to pass to the Accept-Encoding HTTP Header
version - Sets the MTConnect Version to use for the response document. This can be used to request a document using an older version for legacy clients
allowPut - Allow HTTP PUT or POST of data item values or assets.
allowPutFrom - Allow HTTP PUT or POST from a specific host or list of hosts.
indentOutput - Sets the indentation of the response document. True = Indent. False = Do not Indent
outputComments - Sets the default response document comments output. Comments contain descriptions from the MTConnect standard
outputValidationLevel - Sets the default response document validation level. 0 = Ignore, 1 = Warning, 2 = Strict
files - Sets the configuration for Static Files that can be served from the Http Server.
path - The location of the files on the server (where the Agent is running)location - The path to match in the requested URLtls - Sets the TLS settings
pfx - The PFX certificate settings
certificatePath - The path to the (.pfx) filecertificatePassword - The certificate passwordpem - The PEM certificate settings
certificatePath - The path to the (.pem) fileprivateKeyPath - The path to the key containing the private keyprivateKeyPassword - The certificate passwordcertificateAuthority - The path to the (.pem) file containing the Certificate AuthorityverifyClientCertificate - Toggles whether Client Certificate chains are verified ("true" or "false")
Use defualt configuration
modules:
- http-server:
Specify the port
modules:
- http-server:
port: 5001
Specify the port and hostname to an IP Address
modules:
- http-server:
hostname: 192.168.1.145
port: 5001
Specify the port and hostname
modules:
- http-server:
hostname: DESKTOP-HV74M4N
port: 5001
Specify the port and hostname with TLS (PFX Certificate)
modules:
- http-server:
hostname: DESKTOP-HV74M4N
port: 5001
tls:
pfx:
certificatePath: c:\certs\mtconnect-testing.pfx
certificatePassword: mtconnect
Specify the port and hostname with TLS (PEM Certificate)
modules:
- http-server:
hostname: DESKTOP-HV74M4N
port: 5001
tls:
pem:
certificateAuthority: c:\certs\rootCA.crt
certificatePath: c:\certs\mtconnect-testing.crt
privateKeyPath: c:\certs\mtconnect-testing.key
privateKeyPassword: mtconnect
Specify with custom Accept headers
modules:
- http-server:
accept:
text/xml: xml
application/json: json-cppagent
This application and it's source code is licensed under the MIT License and is free to use.