.net 4.0 and incoming HTTP connection

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
edx
Newbie
Newbie
Posts: 3
Joined: Mon Dec 07, 2020 4:05 am

.net 4.0 and incoming HTTP connection

Post by edx »

Hello! Problem with application coded on C# using >=.NET 4.0 .
When using class HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:1234/listener/");
listener.Start();
When try to connect on this port with browser - on wine connection freeze, on windows all ok
А more detailed study of the issue revealed, when try connect with telnet to port on wine we have answer:
HTTP/1.1 400 Bad Request
Date: Mon, 07 Dec 2020 08:55:29 GMT
Content-Type: text/html; charset=utf-8
Content-Language: en
Connection: close

windows answer:

HTTP/1.1 400 Bad Request
Content-Type: text/html; charset=us-ascii
Server: Microsoft-HTTPAPI/2.0
Date: Mon, 07 Dec 2020 09:15:51 GMT
Connection: close
Content-Length: 326

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/str
ict.dtd">
<HTML><HEAD><TITLE>Bad Request</TITLE>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"></HEAD>
<BODY><h2>Bad Request - Invalid Verb</h2>
<hr><p>HTTP Error 400. The request verb is invalid.</p>
</BODY></HTML>

0140:trace:winsock:WS_accept 0x74
0140:trace:winsock:WS_accept returning 0xa4
0140:trace:winsock:WSAEventSelect 00a4, hEvent 0x60, event 00000021
0140:trace:winsock:WSAIoctl 00a4, FIONBIO, 0xd1ff1c, 4, 0xd1ff1c, 4, 0xd1fecc, (nil), (nil)
0140:trace:winsock:WSAIoctl -> FIONBIO (1)
0140:trace:winsock:WS2_recv_base socket 00a4, wsabuf 0xd1fec8, nbufs 1, flags 0, from (nil), fromlen -1, ovl (nil), func (nil)
0140:trace:winsock:WS2_recv_base fd=21, options=0
0140:warn:winsock:WS2_recv_base -> ERROR 10035
0140:trace:winsock:WS_accept 0x74
0140:warn:winsock:WS_accept failed; status 0xc0012733
0140:trace:winsock:WS2_recv_base socket 00a4, wsabuf 0xd1fec8, nbufs 1, flags 0, from (nil), fromlen -1, ovl (nil), func (nil)
0140:trace:winsock:WS2_recv_base fd=21, options=0
0140:trace:winsock:WS2_recv_base -> 1 bytes
0140:trace:winsock:WSAIoctl 00a4, FIONREAD, 0xd1ff1c, 4, 0xd1ff1c, 4, 0xd1fecc, (nil), (nil)
0140:trace:winsock:WS_accept 0x74
0140:warn:winsock:WS_accept failed; status 0xc0012733
0140:trace:winsock:WS2_recv_base socket 00a4, wsabuf 0xd1fec8, nbufs 1, flags 0, from (nil), fromlen -1, ovl (nil), func (nil)
0140:trace:winsock:WS2_recv_base fd=21, options=0
0140:trace:winsock:WS2_recv_base -> 2 bytes
0140:warn:http:receive_data Failed to parse request; shutting down connection.
0140:trace:winsock:WS2_sendto socket 00a4, wsabuf 0xd1fdb8, nbufs 1, flags 0, to (nil), tolen 0, ovl (nil), func (nil)
0140:trace:winsock:WS2_sendto fd=21, options=0
0140:trace:winsock:WS2_sendto -> 144 bytes
0140:trace:winsock:WS_shutdown socket 00a4, how 0x2, options 0x0
0140:trace:winsock:WS2_register_async_shutdown socket 00a4 type 1
0140:trace:winsock:WS2_register_async_shutdown socket 00a4 type 2
0140:trace:winsock:WSAAsyncSelect 00a4, hWnd (nil), uMsg 00000000, event 00000000
0140:trace:winsock:WS_closesocket (socket 00a4) -> 0

Please help! Thanx to advance!
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: .net 4.0 and incoming HTTP connection

Post by savelov »

you do not give a link to the application - do you have a test application that shows the same behaviour? ideally with source code
edx
Newbie
Newbie
Posts: 3
Joined: Mon Dec 07, 2020 4:05 am

Re: .net 4.0 and incoming HTTP connection

Post by edx »

Hello! Source compiled with VS 2013 https://yadi.sk/d/n8zPQkhPHuiA9Q
Any version of wine and NET Framework 4.0 and stuck :(
Thanx!
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: .net 4.0 and incoming HTTP connection

Post by savelov »

worked for me under wine 5.0.1 installed in ubuntu 20.10
Application compiled under Visual Studio Community 2017, against .NET 4.6.1
Tested from local browser using http://localhost:1234/conn
Did you use built-in winemono?

Code: Select all

wine ConsoleApplication1.exe 
0009:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6.1" not implemented
0009:fixme:mscoree:parse_supported_runtime sku=L".NETFramework,Version=v4.6.1" not implemented
Wait for connections...
Bye!
0037:fixme:console:CONSOLE_DefaultHandler Terminating process 8 on event 0
0037:err:mscoree:expect_no_runtimes Process exited with a Mono runtime loaded.
edx
Newbie
Newbie
Posts: 3
Joined: Mon Dec 07, 2020 4:05 am

Re: .net 4.0 and incoming HTTP connection

Post by edx »

Hello! Thanx for answer! Is work for me too with builtin winemono, but i have .NET app is not work with winemono and require.net runtime 4.6.1.
savelov
Level 2
Level 2
Posts: 46
Joined: Sun Jan 10, 2010 5:46 am

Re: .net 4.0 and incoming HTTP connection

Post by savelov »

Hi edx,
I would try to debug .NET app and try to convert it to be compatble with winemono - eventually this will allow you to be cross-platform.
e.g. try to use FreeTDS client to access MS SQL and other simialr approaches. I had some experience on it and I think this is feasible.
You can debug it by installing mono on windows, and developing there, and then when it succeeds proceed with testing with winemono.
You can contact me and I can share my experience.
As a succesful cross-platform example - I can suggest fastreport.mono - https://www.fast-report.com/en/blog/232/show/
Locked