Click here to Skip to main content
15,887,350 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
code :
string name =Dns.GetHostEntry(machineName).HostName

Dns.GetHostEntry throws an exception "
The size of hostName is too long. It cannot be longer than 255 characters.
"
Stacktrace :
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)


  at System.Net.Dns.GetHostEntry(String hostNameOrAddress)


What I have tried:

I am calling this function from script written in installshield project. I tried upgrading dotnet framework.
Posted
Updated 6-Sep-19 7:28am
Comments
jimmson 4-Sep-19 3:46am    
Are you sure you are passing the hostname and not something else?
Member 11435767 4-Sep-19 3:57am    
Yes I have tried code same code of line in Console App. It gets executed perfectly. But the issue with installshield script. When calling from installshield script giving this exception

1 solution

The value you're passing in machineName is too long. A host name cannot be longer than 255 characters.

You haven't shown the code that's initializing that variable, so we can't tell you why the value is wrong.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900