환경이 가능할 수도 있습니다 .MachineName은 0 길이의 문자열을 반환합니다.

StackOverflow https://stackoverflow.com/questions/6042976

문제

고객 사이트에서 이상한 오류를 쫓고 있으며 Environment.MachineName가 0 길이의 길이 문자열을 반환 할 수 있는지 궁금해했습니다.문서는 레지스트리에서 읽지 만 어디에서 지정하지 않습니다.나는 기계가 NetBIOS 이름을 가질 수 없지만 묻는 것을 상상할 수 없습니다.

편집

조사 후에 이것은 이것이 0 길이의 길이 문자열을 반환하지 않았지만 실현 가능성이있는 경우에도 관심이있었습니다.

도움이 되었습니까?

해결책

I don't know if it can be an empty string, sorry, but concerning the registry you might want to check the following (and subkeys):

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ComputerName

On my system it is actually looking at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerName:

enter image description here

BTW, as you can see I tried to figure this out using SysInternals Process Monitor, but initially failed. Then i figured, that the above keys (and some related ones) are suppressed by default. Just in case you try the same be aware of that.

You might also check the value of the %COMPUTERNAME%. Although I have no reference or direct evidence, I would assume that it gets its value from the same source.

I know this is not a real answer to your question, but it wouldn't fit in a comment either.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top