#1 2018-10-12 13:44:09

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Access to MVC application from another device

About example 30.
If I visit localhost:8092 from PC where I run the server application I see the client side on browser, but if I try to visit 192.168.xxx.xxx:8092 (192.168.xxx.xxx is ip of my server on my LAN) from other device (I have try from android phone with chrome) I cannot establish the connection. I just have set the firewall.
Do I need anything else?

Offline

#2 2018-10-15 21:09:32

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Access to MVC application from another device

You can try with plain socket server by defining ONLYUSEHTTPSOCKET in  Synopse.inc line 604 to be sure this is not a HTTP.SYS related problem

Offline

#3 2018-10-16 06:31:51

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Access to MVC application from another device

mpv wrote:

You can try with plain socket server by defining ONLYUSEHTTPSOCKET in  Synopse.inc line 604 to be sure this is not a HTTP.SYS related problem

In this moment I have solve the problem using "useBidirSocket" instead of "useHttpApiRegisteringURI".
This works though I get some error message on debug.

Offline

#4 2018-10-16 13:13:38

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Access to MVC application from another device

So the problem is in HTTP.SYS registration table (useBidirSocket use plain socket server). Most of all you have some "old" entries in http.sys registration table (call `netsh http show urlacl` as admin to see all entries and remove all entries related to port 8092 in your case)

Offline

#5 2018-10-16 21:07:53

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Access to MVC application from another device

mpv wrote:

So the problem is in HTTP.SYS registration table (useBidirSocket use plain socket server). Most of all you have some "old" entries in http.sys registration table (call `netsh http show urlacl` as admin to see all entries and remove all entries related to port 8092 in your case)

So I have:
1. Show allmy "old" entries with "netsh http show urlacl" as admin;
2. Delete all entries about port 8092 with "netsh http delete urlacl url=http://+:8092/", "netsh http delete urlacl url=http://+:8092/...", ...
3. Replace "useBidirSocket" with "useHttpApiRegisteringURI";
4. Run my application as admin the first time.

In this way I get the same result. I cannot access to my MVC application from external device.

Now the entries are correct.

Last edited by array81 (2018-10-16 21:09:21)

Offline

#6 2018-10-18 22:27:28

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Access to MVC application from another device

@Sapiem write something similar it this topic - https://synopse.info/forum/viewtopic.php?id=4656

I think the problem is somewhere in your Windows settings. Yes, windows sometimes is painful.

Offline

#7 2018-10-21 07:27:16

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Access to MVC application from another device

mpv wrote:

@Sapiem write something similar it this topic - https://synopse.info/forum/viewtopic.php?id=4656

I think the problem is somewhere in your Windows settings. Yes, windows sometimes is painful.

Good. It will be fun find the problemi.

Offline

#8 2018-11-28 07:28:07

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Access to MVC application from another device

mpv wrote:

@Sapiem write something similar it this topic - https://synopse.info/forum/viewtopic.php?id=4656

I think the problem is somewhere in your Windows settings. Yes, windows sometimes is painful.

Today I did some tests on a new PC (just bought so with Windows 10 clear installation), the result is the same. The "client side" is accessible from PC (when I run the application as administrator the first time) but not from other PCs connect by LAN (both cable and wifi).
useBidirSocket works but not useHttpApiRegisteringURI.

Any suggestions?

Offline

#9 2018-11-28 08:13:40

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,571
Website

Re: Access to MVC application from another device

The latest info from my DevOps - for external access to Windows 10 HTTP.SYS  based server initial registration (urlacl entry) should be a host name, not a + or *. So you should replace "+" to the host name. Hope it help

Offline

#10 2018-11-28 09:14:34

array81
Member
From: Italy
Registered: 2010-07-23
Posts: 411

Re: Access to MVC application from another device

mpv wrote:

The latest info from my DevOps - for external access to Windows 10 HTTP.SYS  based server initial registration (urlacl entry) should be a host name, not a + or *. So you should replace "+" to the host name. Hope it help

I have replace symbol with IP address of my server PC but nothing change. Works only in local. I cannot access from external (LAN) PC/smartphone.

This is crazy thing. Am I the only one to have this problem?

Offline

#11 2018-11-28 11:17:26

xalo
Member
Registered: 2016-09-22
Posts: 32

Re: Access to MVC application from another device

I think this is an issue related with windows firewall or antivirus.
Please, first check locally
· http://192.168.xxx.xxx:8092/<root defined>/timestamp
· or http://192.168.xxx.xxx:8092/<root defined>/mvc-info

then disable firewall and any antivirus and check from another computer same urls.
If it works, create an exception in firewall and enable again, and recheck it.
If the issue persists, please publish the results.

Hope it help

Offline

#12 2019-03-19 15:45:51

wai-kit
Member
From: Amsterdam, the Netherlands
Registered: 2012-11-27
Posts: 90

Re: Access to MVC application from another device

I am running more or less to the same connection problem:

- on the same PC, client is able to connect to server
- with firewall on client cannot connect to server although the server has been added to the firewall rules.
   I have already run the server as administrator
- with firewall off client can connect to server

server code:     fHttpServerDefault := TSQLHttpServer.Create('8092', [fRestServerDefault], '+', HTTP_DEFAULT_MODE);

client code:     fRestClient := TSQLHttpClient.Create(fServerName, '8092', fModelDefault);  // fServername='192.168.1.xxx'

FYI, the sample Project04 works flawlessly.

Does someone have an idea what I am missing?

Thanks in advance.

Last edited by wai-kit (2019-03-19 16:07:34)


fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...

Offline

#13 2019-03-19 16:17:51

wai-kit
Member
From: Amsterdam, the Netherlands
Registered: 2012-11-27
Posts: 90

Re: Access to MVC application from another device

Since sample project04 was working and the difference was in the Port used, I decided to change the port number from 8092 to 8080 and
now it worked! My client can connect to the server! :-)


fpcdeluxe, FPC 3.2 / Lazarus 2.0, mORMot on Windows 10 ...

Offline

Board footer

Powered by FluxBB