Register Daphne as a windows service but NOT run, why?

OS: windows 10 or windows server
anaconda: 4.8.3v and python in it is : 3.8v
Django: 3.1
I build a websocket project with Django , and use Daphne as the ASGI webserver.
with the following .bat files, to build a windows service:

@echo off
cd pycharm/websocket_pro/
daphne websocket_pro.asgi:application

sc create webocket_service binPath=E:/pycharm/websocket_pro/reg.bat start=auto

the sevice could be built, but not run!

in Anaconda Promt, directly run code “daphne websocket_pro.asgi:application”, it works!
but, in cmd, run “daphne websocket_pro.asgi:application”, it gives error: “ImportError: DLL load failed while importing _sqlite3: %1 not effective Win32 program”

why!? have any solution for it?

In my experiences (which isn’t very much for stuff like this), these types of problems can be caused by either permissions or path issues, where the service can’t read (permissions) or can’t find (path) the dll attempting to be loaded.

I’d check the ID that I’m using to run the service to ensure it has permissions to everything it needs, and I’d also make sure that that service account has all the right directories in the path.

The top StackOverflow result for that error seems to imply this could be a 64/32bit compatibility issue.

It looks like a Windows/Python/setup issue rather than anything specifically Django related. You might find folks with more knowledge here on StackOverflow I’d say.
Good luck.