# Illegal character in hostname (NS\_CCM) exception while establishing OPC-UA Communication

**URL:** <https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382>\
**Category:** Ignition\
**Created:** [May 29, 2019, 2:45am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382 "2019-05-29T02:45:57Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![avinashpise](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@avinashpise](https://forum.inductiveautomation.com/u/avinashpise)\
**Post date:** [May 29, 2019, 2:45am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/1 "2019-05-29T02:45:57Z")

</div>

We have WinCC OPC-UA server with below details

Host Name: NS\_CCM  
IP Address: 10.169.57.7  
Port: 4862

We have successfully connected third party OPC UA client (using IP address)

But when we are trying to communicate using Ignition OPC-UA, we are getting “Illegal Character in Hostname” Exception

Discover endpoint using IP address (Enclosed few snapshots)

 ![endpoint](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c1eeac9c5c3c64c600a469c7fa15ae5ebbc1d4e0.png)

 ![error](https://us1.discourse-cdn.com/inductiveautomation/original/2X/6/68f2bd56c70bd6a3e4b9f2c2a317e0805f349b5a.png)

Any help on this, much appreciated

Thanks  
Avinash

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 29, 2019, 3:09am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/2 "2019-05-29T03:09:27Z")

</div>

Underscores are not generally allowed in host names, though many systems do so, and there are ways to support more.

> <https://stackoverflow.com/questions/3523028/valid-characters-of-a-hostname>

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 29, 2019, 9:25am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/3 "2019-05-29T09:25:01Z")

</div>

Try setting the “Host Override” advanced property to the IP address you used in the discovery step.

---

<div class="post-metadata">

**Author:** ![avinashpise](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@avinashpise](https://forum.inductiveautomation.com/u/avinashpise)\
**Post date:** [May 30, 2019, 2:10am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/4 "2019-05-30T02:10:18Z")

</div>

Step 1 :  
To trick the system, I have added different host name “NS-CCM3” against IP “10.169.57.7” in Windows/System32/driver/hosts file and tried pinging with new host name.

But same if I go with Ignition discover point, Ignition is discovering original host name from DNS

Step 2:  
Tried setting “Host Override” in advance property with IP address, now getting new error “OPC server connection is faulted. Type “Production\_ServerType” is not a known server type.” (Enclosed snapshot)

 ![error_1](https://us1.discourse-cdn.com/inductiveautomation/original/2X/b/b850b86105fb3a736e93462892e2c0037d251a6f.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 30, 2019, 2:57am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/5 "2019-05-30T02:57:41Z")

</div>

“Production\_ServerType” is something the OEE/Downtime modules add. You must be looking at the status for their wrong connection now.

Also, I didn’t realize you were on 7.9.5. It might be worth seeing if this is fixed in 7.9.10 or 7.9.11.

---

<div class="post-metadata">

**Author:** ![avinashpise](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@avinashpise](https://forum.inductiveautomation.com/u/avinashpise)\
**Post date:** [May 30, 2019, 3:44am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/6 "2019-05-30T03:44:07Z")

</div>

Hi Kevin, I didn’t realize that i have installed older trial version for testing.  
I have tried your suggestion on actual production server “7.9.10” and restarted gateway services

 ![1](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fd07ae2c1741b72f112f20072b308286ac6d8a84.png)

Still getting same error “java.net.URISyntaxException: Illegal character in hostname at index 12: opc.tcp://NS\_CCM3:4862”

 ![2](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c08253fa1515f87ce5d31933a85672d590ccc3b9.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 30, 2019, 11:04am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/7 "2019-05-30T11:04:46Z")

</div>

It looks like we’ve added a workaround to 7.9.11 that should make using the IP address on the discovery step and then again in the host override work.

Previously both Ignition and the UA stack it uses relied on Java’s URI class to parse the endpoint URLs, which is a strict implementation that correctly fails to parse URLs that have an underscore in them because it’s not a legal character.

It’s unfortunate that this device uses a Windows hostname with an underscore by default. I’ve seen this previously with people trying to connect to Beckhoff devices.

---

<div class="post-metadata">

**Author:** ![avinashpise](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@avinashpise](https://forum.inductiveautomation.com/u/avinashpise)\
**Post date:** [May 31, 2019, 3:17am UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/8 "2019-05-31T03:17:06Z")

</div>

Dear Kevin Thanks for all your help,

I have tried installing newer version of ignition (8.0.1) and i could able to connect OPC-UA successfully.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/45d5d978d731e620342a57a8d20492fa1076e856.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [May 31, 2019, 2:50pm UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/9 "2019-05-31T14:50:49Z")

</div>

Yes, it’s fixed in 8.0.x as well.

---

<div class="post-metadata">

**Author:** ![bruce.burton](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@bruce.burton](https://forum.inductiveautomation.com/u/bruce.burton)\
**Post date:** [February 26, 2021, 2:38pm UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/10 "2021-02-26T14:38:22Z")

</div>

I’m using Ignition 7.9.7 that has the same issue. In my case, the illegal character (underscore) is in the domain name. Kepware is the OPC server we are connecting to and it gives the fully qualified host name in the endpoint url. Short of upgrading Ignition or changing the domain name, is there any other work around on the Ignition side? I’ve looked for a way to force Kepware to use the ip address instead of host name but haven’t been successful. It appears that it will do that but only if it can’t resolve the host name.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [February 26, 2021, 2:40pm UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/11 "2021-02-26T14:40:17Z")

</div>

You could try adding a hostname entry to your hosts file that is legal and and points to the Kepware machines IP and then create the connection using that hostname… not sure if that will work or break somewhere else though.

Best bet is an upgrade.

---

<div class="post-metadata">

**Author:** ![bruce.burton](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@bruce.burton](https://forum.inductiveautomation.com/u/bruce.burton)\
**Post date:** [February 26, 2021, 2:51pm UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/12 "2021-02-26T14:51:47Z")

</div>

Thanks for the quick reply, Kevin.

I actually tried that already. The host file (on the ignition side) is only used when doing the discovery. Kepware still replies with the URLs and uses the fully qualified host name from the server side.

Unfortunately, this is a validated server so upgrading Ignition is an option that I can do in the short term. Upgrade is planned for next year.

---

<div class="post-metadata">

**Author:** ![bruce.burton](https://avatars.discourse-cdn.com/v4/letter/b/67e7ee/32.png) [@bruce.burton](https://forum.inductiveautomation.com/u/bruce.burton)\
**Post date:** [February 26, 2021, 6:49pm UTC](https://forum.inductiveautomation.com/t/illegal-character-in-hostname-ns-ccm-exception-while-establishing-opc-ua-communication/25382/13 "2021-02-26T18:49:36Z")

</div>

Kevin,

It turned out not to be a road block. Kepware uses the fully qualified computer name when you select the Default network adaptor in the endpoint configuration. If you modify the endpoint to use a specific network adaptor, the endpoint URL changes to the IP address.

Thanks again.
