delphi windows service can't download file fro

2019-03-03 09:20发布

i have a windows service written in delphi,the service will use to downloading a file from my website but it can't download the file,it doesn't thrown any exception also i change the destination path and the file to be download but the result was same,my firewall was off too,my project work properly in another PC that i test on it and in windows application my function works properly too, so what should be the problem ? thx for ur time

4条回答
狗以群分
2楼-- · 2019-03-03 09:48

Services cannot access Network Resources, such as via UNC paths, without additional access rights applied. But a service has unrestricted access to use TCP and UDP sockets. I've written several services that connect to remote servers via TCP/IP and they work fine without extra configurations or access rights needed.

查看更多
贪生不怕死
3楼-- · 2019-03-03 09:55

Normaly, under LocalSystem, a service can't access network resources. You said it works with another PC, I can't explain why. You said it works in another application, yes, because application is executed with current account.

The solution may be to execute the service under the Network Serviceaccount. Check it to see if it fixes the issue !

查看更多
一纸荒年 Trace。
4楼-- · 2019-03-03 10:09

You can use a tool like Wireshark to capture and check the HTTP session, and understand if it is an issue at the transport level or something else.

查看更多
你好瞎i
5楼-- · 2019-03-03 10:10

Check the access rights of the user the service runs under.

By default it is LocalSystem, which may not be allowed to access remote networks (i.e the Internet). Try running it under the same user you logged in as.

Hope this helps

查看更多
登录 后发表回答