❔ Win service error..
i wonder why win32 service does not work well..
this code works well in not service
i don't know what's the problem
40 Replies
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
help... plz
So you say, this code works fine in your IDE, but you wanna run it as a windows service, where it doesn't work?
(also, I'll just assume, that the duplicate code above is not on purpose)
when i execute this code as win service, port opens successfully, but send data doesn't work..
Send dataCan we see some of the code? The above code just retrieves some device information and doesn't send data
sry i mean device info
i don't need to send data 🙂
and thanks for helping me
Yeah, I give my best. But we need more information. Do you know what exactly does not work? Does it not retrieve information, i.e. those functions return null? Does it crash?
I know Winservice doesnt support log function so i cant check specific reason why it doesnt work.. is there any way to check log??
By default, the service should write into the application event log, have you checked that? you can write your own event log https://learn.microsoft.com/en-us/dotnet/framework/windows-services/how-to-log-information-about-services
Oh thanks!! i'll try it later when i go back home and tell u specific info where does not work 🙂
Maybe 2h later?? I'll be back soon😀
i wrote event log and installed winservice but when i install them, it says error 1053... i searched internet but i can't find answer.. do u know how to fix it?
when u come back, mention me plz 🙂
What's the full error saying? Also, can you show the code?
Error 1053 the service did not respond to the start or control request
This can have a couple of reasons. Best would be to check if the error log has useful information
u mean event viewer?
Yes
nono not this one sry
i can't see any log in here..
Something with an ID of 1026 perhaps?
ah how can i fix it?
is it event viewer?
Yes
i cant find that one in here 😦
this one, no?
yes
but i cant type 1026
ah sry i found solution
oh
Application: dotnet.exe
CoreCLR Version: 7.0.222.60605
.NET Version: 7.0.2
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Net.Sockets.SocketException (10048): 각 소켓 주소(프로토콜/네트워크 주소/포트)는 하나만 사용할 수 있습니다.
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, Boolean disconnectOnFailure, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.Net.Sockets.TcpListener.Start(Int32 backlog)
at Server.PcRegister()
i think this error means i had already bind port
i think i need to kill process using 50520 port
I killed process and restarted service but same
Ah.. sry for too much question...
각 소켓 주소(프로토콜/네트워크 주소/포트)는 하나만 사용할 수 있습니다what does this say exactly? Oh, already bound?
yhea so i killed the task but i can't solve the problem
can you try the following?
before
ok wait a second plz
same 😦
Is the port important or can it be chosen freely?
important because i used 50520 in android application
How do I create a thread in C#?
i think its the problem
where ThreadStart can be some delegate. Are you sure that's the problem?
I'll do it tomorrow i'm so tired 😦
Have a nice day and see u tomorrow 🙂
I'll try more and ask u about it thank you very much today !!
Have a good and rejuvenating sleep
i successfully created custom log and now i can check log !!
as u can see, port opened but send info has an error
error in here
I think sock.accept has an error sk i cant see connected log
Is there any problem with code?
Plz mention me after u comeback 🙂
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.