I've been made aware that aiosmtpd logs to the syslog. I'm using a Red Hat Linux distribution and can't find anything related to my SMTP server in the messages or maillog file. I'm trying to debug an issue with a device that can't connect to my SMTP server with basic authentication as I can't find any reason why the device is being rejected by my server. The only way I've been able to debug so far is by using the EHLO and MAIL handlers and printing a message when that stage of the connection is reached. Ideally, I'd like as much as possible to be logged out, like with smtplib that enables you to see each message between the client and server. Is it possible to do this or some basic logging at least and how do I do it if so? The code I'm using is:
import email
from email.header import decode_header
from email import message_from_bytes
from email.policy import default
from aiosmtpd.controller import Controller
from aiosmtpd.smtp import LoginPassword, AuthResult
import os
import json
import re
import sys
import time
import signal
import logging
from datetime import datetime
import configparser
##setting timezone
os.environ['TZ'] = "Europe/London"
time.tzset()
#wildlifeCameraHome = os.getenv('WILDLIFE_CAMERA_HOME')
wildlifeCameraHome = "/home/matthew_gale/smtp-server"
startupConfigURL = "{}/Config/Config.ini".format(wildlifeCameraHome)
validCameraList = "{}/Config/ValidCameraIDs.txt".format(wildlifeCameraHome)
ouboxBaseURL = "{}/outbox".format(wildlifeCameraHome)
spacer = "*"*100
# Get command line parameters
if len( sys.argv ) > 1 and str( sys.argv[1] ) == "DEBUG":
debugMode = True
else:
debugMode = False
if not debugMode:
logFileURL = "{}/Logging/EmailExtractorLog.out".format(wildlifeCameraHome)
sys.stdout = open(logFileURL, 'a', 1)
sys.stderr = sys.stdout
if os.environ.get('VA_LOG_LEVEL') is None:
envlevel = 3
else:
envlevel = int(os.environ.get('VA_LOG_LEVEL'))
def Lprint(logstring, loglevel):
detailedtimeStamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
if loglevel <= envlevel or debugMode:
print(detailedtimeStamp + ":" + logstring)
return True
else:
return None
def onExit( sig, func=None):
Lprint("*************Stopping program*****************",3)
controller.stop()
exit()
signal.signal(signal.SIGTERM, onExit)
# removes the spaces and replaces with _ so they're valid folder names
def clean(text):
return "".join(c if c.isalnum() else "_" for c in text)
#get the configs from the config file
config = configparser.ConfigParser()
config.read(startupConfigURL)
gmailConfig = config['EmailExtractor']
validEmail = gmailConfig['validSender']
# check at the end if there's any validation regarding who sends the email
with open(validCameraList, 'r', encoding='utf-8') as f:
validCameraIDs = f.readlines()
for rowNumber, content in enumerate(validCameraIDs):
validCameraIDs[rowNumber] = content.replace("\n","")
Lprint("Valid cameraIDs are",3)
print (validCameraIDs)
auth_db = {
b"TestCamera1#gmail.com": b"password1",
b"user2": b"password2",
b"TestCamera1": b"password1",
}
def authenticator_func(server, session, envelope, mechanism, auth_data):
# Simple auth - is only being used because of the reolink cam
assert isinstance(auth_data, LoginPassword)
username = auth_data.login
password = auth_data.password
if auth_db.get(username) == password:
return AuthResult(success=True)
else:
return AuthResult(success=False, handled=False)
def configure_logging():
file_handler = logging.FileHandler("aiosmtpd.log", "a")
stderr_handler = logging.StreamHandler(sys.stderr)
logger = logging.getLogger("mail.log")
fmt = "[%(asctime)s %(levelname)s] %(message)s"
datefmt = None
formatter = logging.Formatter(fmt, datefmt, "%")
stderr_handler.setFormatter(stderr_handler)
logger.addHandler(stderr_handler)
file_handler.setFormatter(file_handler)
logger.addHandler(file_handler)
logger.setLevel(logging.DEBUG)
class CustomHandler:
def handle_exception(self, error):
Lprint("exception occured",3)
print(error)
return '542 Internal Server Error'
async def handle_DATA(self, server, session, envelope):
peer = session.peer
data = envelope.content # type: bytes
msg = message_from_bytes(envelope.content, policy=default)
# decode the email subject
Lprint("Msg:{}".format(msg),3)
Lprint("Data:{}".format(data),3)
Lprint("All of the relevant data has been extracted from the email",3)
Lprint(spacer,3)
return '250 OK'
if __name__ == '__main__':
configure_logging()
handler = CustomHandler()
controller = Controller(handler, hostname='0.0.0.0', port=587, authenticator=authenticator_func, auth_required=True,auth_require_tls=False)
# Run the event loop in a separate thread.
controller.start()
#Confirmed that this is needed to keep the SMTP server running constantly
while True:
time.sleep(10)
If you search the aiosmtpd codebase for "logging.getLogger", you can find a few places where logging is being configured with Python's standard logging module.
In order to actually see these log messages, you need to configure the log level and add a log handler. Try calling the following "configure_logging" function early in your program. It will set up basic logging to stderr and to a file named "aiosmtpd.log". Complete example:
import logging
import sys
def configure_logging():
file_handler = logging.FileHandler("aiosmtpd.log", "a")
stderr_handler = logging.StreamHandler(sys.stderr)
logger = logging.getLogger("mail.log")
fmt = "[%(asctime)s %(levelname)s] %(message)s"
datefmt = None
formatter = logging.Formatter(fmt, datefmt, "%")
stderr_handler.setFormatter(formatter)
logger.addHandler(stderr_handler)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
logger.setLevel(logging.DEBUG)
configure_logging()
# aiosmtpd example from https://stackoverflow.com/a/43904837/1570972
import aiosmtpd.controller
class CustomSMTPHandler:
async def handle_DATA(self, server, session, envelope):
print(len(envelope.content), repr(envelope.content[:50]))
return '250 OK'
handler = CustomSMTPHandler()
server = aiosmtpd.controller.Controller(handler, hostname="127.0.0.1")
server.start()
input("Server started. Press Return to quit.\n")
server.stop()
Running the above script in one terminal and then running swaks --server '127.0.0.1:8025' --to foo#example.com in another (the Swiss Army Knife for SMTP) to send a test email gives the following output on the terminal:
[2021-12-07 19:37:57,124 INFO] Available AUTH mechanisms: LOGIN(builtin) PLAIN(builtin)
[2021-12-07 19:37:57,124 INFO] Peer: ('127.0.0.1', 44126)
[2021-12-07 19:37:57,125 INFO] ('127.0.0.1', 44126) handling connection
[2021-12-07 19:37:57,125 DEBUG] ('127.0.0.1', 44126) << b'220 alcyone.localdomain Python SMTP 1.4.2'
Server started. Press Return to quit.
[2021-12-07 19:37:57,126 INFO] ('127.0.0.1', 44126) EOF received
[2021-12-07 19:37:57,126 INFO] ('127.0.0.1', 44126) Connection lost during _handle_client()
[2021-12-07 19:37:57,126 INFO] ('127.0.0.1', 44126) connection lost
[2021-12-07 19:38:02,012 INFO] Available AUTH mechanisms: LOGIN(builtin) PLAIN(builtin)
[2021-12-07 19:38:02,012 INFO] Peer: ('127.0.0.1', 44128)
[2021-12-07 19:38:02,013 INFO] ('127.0.0.1', 44128) handling connection
[2021-12-07 19:38:02,013 DEBUG] ('127.0.0.1', 44128) << b'220 alcyone.localdomain Python SMTP 1.4.2'
[2021-12-07 19:38:02,013 DEBUG] _handle_client readline: b'EHLO alcyone.localdomain\r\n'
[2021-12-07 19:38:02,013 INFO] ('127.0.0.1', 44128) >> b'EHLO alcyone.localdomain'
[2021-12-07 19:38:02,013 DEBUG] ('127.0.0.1', 44128) << b'250-alcyone.localdomain'
[2021-12-07 19:38:02,013 DEBUG] ('127.0.0.1', 44128) << b'250-SIZE 33554432'
[2021-12-07 19:38:02,013 DEBUG] ('127.0.0.1', 44128) << b'250-8BITMIME'
[2021-12-07 19:38:02,013 DEBUG] ('127.0.0.1', 44128) << b'250-SMTPUTF8'
[2021-12-07 19:38:02,013 DEBUG] ('127.0.0.1', 44128) << b'250 HELP'
[2021-12-07 19:38:02,014 DEBUG] _handle_client readline: b'MAIL FROM:<rav#alcyone.localdomain>\r\n'
[2021-12-07 19:38:02,014 INFO] ('127.0.0.1', 44128) >> b'MAIL FROM:<rav#alcyone.localdomain>'
[2021-12-07 19:38:02,014 INFO] ('127.0.0.1', 44128) sender: rav#alcyone.localdomain
[2021-12-07 19:38:02,014 DEBUG] ('127.0.0.1', 44128) << b'250 OK'
[2021-12-07 19:38:02,014 DEBUG] _handle_client readline: b'RCPT TO:<foo#example.com>\r\n'
[2021-12-07 19:38:02,014 INFO] ('127.0.0.1', 44128) >> b'RCPT TO:<foo#example.com>'
[2021-12-07 19:38:02,014 INFO] ('127.0.0.1', 44128) recip: foo#example.com
[2021-12-07 19:38:02,014 DEBUG] ('127.0.0.1', 44128) << b'250 OK'
[2021-12-07 19:38:02,014 DEBUG] _handle_client readline: b'DATA\r\n'
[2021-12-07 19:38:02,014 INFO] ('127.0.0.1', 44128) >> b'DATA'
[2021-12-07 19:38:02,015 DEBUG] ('127.0.0.1', 44128) << b'354 End data with <CR><LF>.<CR><LF>'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'Date: Tue, 07 Dec 2021 19:38:02 +0100\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'To: foo#example.com\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'From: rav#alcyone.localdomain\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'Subject: test Tue, 07 Dec 2021 19:38:02 +0100\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'Message-Id: <20211207193802.024948#alcyone.localdomain>\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'X-Mailer: swaks vDEVRELEASE jetmore.org/john/code/swaks/\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'This is a test mailing\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'\r\n'
[2021-12-07 19:38:02,015 DEBUG] DATA readline: b'.\r\n'
283 b'Date: Tue, 07 Dec 2021 19:38:02 +0100\r\nTo: foo#exa'
[2021-12-07 19:38:02,015 DEBUG] ('127.0.0.1', 44128) << b'250 OK'
[2021-12-07 19:38:02,015 DEBUG] _handle_client readline: b'QUIT\r\n'
[2021-12-07 19:38:02,015 INFO] ('127.0.0.1', 44128) >> b'QUIT'
[2021-12-07 19:38:02,015 DEBUG] ('127.0.0.1', 44128) << b'221 Bye'
[2021-12-07 19:38:02,016 INFO] ('127.0.0.1', 44128) connection lost
[2021-12-07 19:38:02,016 INFO] ('127.0.0.1', 44128) Connection lost during _handle_client()
Related
I bought domain, host and email from Godaddy.
I am using phpMailer for my website's email function.
PhpMailer is showing email sent successfully but receiver didn't receive email.
I have put my php code and phpMailler debug log below.
Many thanks for your any suggestion..
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require '/home/vv0srjz4gnsz/public_html/system/library/phpmailer/src/Exception.php';
require '/home/vv0srjz4gnsz/public_html/system/library/phpmailer/src/PHPMailer.php';
require '/home/vv0srjz4gnsz/public_html/system/library/phpmailer/src/SMTP.php';
$mail = new PHPMailer(true);
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->SMTPAuth = false;
$mail->SMTPAutoTLS = false;
$mail->Port = 25;
$mail->SMTPDebug = 3;
$mail->AddAddress('receiver#email.com', 'Receiver');
$mail->SetFrom('sender#email.com', 'Sender');
$mail->Subject = 'My Subject';
$mail->Body = 'Mail contents';
$mail->Username = 'auth#godaddyemaildomain.com';
$mail->Password = '!mypassword';
try{
if ($mail->send()) {
echo 'email sent success';
} else {
echo 'failed to send';
echo $mail->ErrorInfo;
}
} catch(Exception $e){
//Something went bad
echo "Fail - " . $mail->ErrorInfo;
}
?>
Result:
2023-02-17 09:53:11 Connection: opening to localhost:25, timeout=300, options=array()
2023-02-17 09:53:11 Connection: opened
2023-02-17 09:53:11 SERVER -> CLIENT: 220-sg2plzcpnl453267.prod.sin2.secureserver.net ESMTP Exim 4.95 #2 Fri, 17 Feb 2023 02:53:11 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2023-02-17 09:53:11 CLIENT -> SERVER: EHLO www.godaddyDomain.com
2023-02-17 09:53:11 SERVER -> CLIENT: 250-sg2plzcpnl453267.prod.sin2.secureserver.net Hello www.godaddyDomain.com [127.0.0.1]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPE_CONNECT250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2023-02-17 09:53:11 CLIENT -> SERVER: MAIL FROM:<sender#godaddyDomain.com>
2023-02-17 09:53:11 SERVER -> CLIENT: 250 OK
2023-02-17 09:53:11 CLIENT -> SERVER: RCPT TO:<receiver#godaddyDomain.com>
2023-02-17 09:53:11 SERVER -> CLIENT: 250 Accepted
2023-02-17 09:53:11 CLIENT -> SERVER: DATA
2023-02-17 09:53:11 SERVER -> CLIENT: 354 Enter message, ending with "." on a line by itself
2023-02-17 09:53:11 CLIENT -> SERVER: Date: Fri, 17 Feb 2023 09:53:11 +0000
2023-02-17 09:53:11 CLIENT -> SERVER: To: Mr Receiver <receiver#godaddyDomain.com>
2023-02-17 09:53:11 CLIENT -> SERVER: From: Mr Sender <sender#godaddyDomain.com>
2023-02-17 09:53:11 CLIENT -> SERVER: Subject: My Subject
2023-02-17 09:53:11 CLIENT -> SERVER: Message-ID: <muLYFVVw4LfUEMaV9Ot6WWxwnYHXYNs9UB1Mf0atZLU#www.godaddyDomain.com>
2023-02-17 09:53:11 CLIENT -> SERVER: X-Mailer: PHPMailer 6.1.7 (https://github.com/PHPMailer/PHPMailer)
2023-02-17 09:53:11 CLIENT -> SERVER: MIME-Version: 1.0
2023-02-17 09:53:11 CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1
2023-02-17 09:53:11 CLIENT -> SERVER:
2023-02-17 09:53:11 CLIENT -> SERVER: Mail contents
2023-02-17 09:53:11 CLIENT -> SERVER:
2023-02-17 09:53:11 CLIENT -> SERVER: .
2023-02-17 09:53:11 SERVER -> CLIENT: 250 OK id=1pSxQV-00HNWK-K8
2023-02-17 09:53:11 CLIENT -> SERVER: QUIT
2023-02-17 09:53:12 SERVER -> CLIENT: 221 sg2plzcpnl453267.prod.sin2.secureserver.net closing connection
2023-02-17 09:53:12 Connection: closed
email sent success
Any suggestion is appreciated..
Thanksss.
There are a myriad of reasons why your post was possibly not been received.
SPF, DMARC, DKIM, Blacklists...
It would help to start with your main.cf file parameters.
Have you inspected your mail logs?
Use the "tail" command and post any relevant errors.
My code:
from telethon import TelegramClient, connection
import logging
logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s',
level=logging.DEBUG)
api_id = 1234567
api_hash = '1234567890abcdef1234567890abcdef'
client = TelegramClient('anon', api_id, api_hash)
client.start()
I'm trying to connect to telegram via a telethon, but I always get this error:
[DEBUG/2020-06-05 11:40:42,860] asyncio: Using selector: SelectSelector
[ INFO/2020-06-05 11:40:43,006] telethon.network.mtprotosender: Connecting to 1.1.1.1:111/TcpFull...
[DEBUG/2020-06-05 11:40:43,009] telethon.network.mtprotosender: Connection attempt 1...
[WARNING/2020-06-05 11:40:53,011] telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError:
[DEBUG/2020-06-05 11:40:54,024] telethon.network.mtprotosender: Connection attempt 2...
[WARNING/2020-06-05 11:41:04,026] telethon.network.mtprotosender: Attempt 2 at connecting failed: TimeoutError:
[DEBUG/2020-06-05 11:41:05,059] telethon.network.mtprotosender: Connection attempt 3...
[WARNING/2020-06-05 11:41:15,061] telethon.network.mtprotosender: Attempt 3 at connecting failed: TimeoutError:
[DEBUG/2020-06-05 11:41:16,084] telethon.network.mtprotosender: Connection attempt 4...
[WARNING/2020-06-05 11:41:26,086] telethon.network.mtprotosender: Attempt 4 at connecting failed: TimeoutError:
[DEBUG/2020-06-05 11:41:27,088] telethon.network.mtprotosender: Connection attempt 5...
[WARNING/2020-06-05 11:41:37,076] telethon.network.mtprotosender: Attempt 5 at connecting failed: TimeoutError:
[DEBUG/2020-06-05 11:41:38,079] telethon.network.mtprotosender: Connection attempt 6...
[WARNING/2020-06-05 11:41:48,093] telethon.network.mtprotosender: Attempt 6 at connecting failed: TimeoutError:
Traceback (most recent call last):
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\cfc.py", line 11, in
client.start()
File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\telethon\client\auth.py", line 132, in start
else self.loop.run_until_complete(coro)
File "C:\Users\xxx\AppData\Local\Programs\Python\Python37-32\lib\asyncio\base_events.py", line 579, in run_until_complete
return future.result()
File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\telethon\client\auth.py", line 139, in _start
await self.connect()
File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\telethon\client\telegrambaseclient.py", line 478, in connect
proxy=self._proxy
File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\telethon\network\mtprotosender.py", line 125, in connect
await self._connect()
File "C:\Users\xxx\AppData\Roaming\Python\Python37\site-packages\telethon\network\mtprotosender.py", line 250, in _connect
raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 5 time(s)
to whom may concern! you need to add a proxy parameter to your TelegramClient
import socks
proxy = (socks.SOCKS5, 'your socks proxy IP', 'your socks proxy port')
TelegramClient(proxy=proxy, 'add other required arguments')
there's a simple chat program using the asyncio library of Python. The clients can communicate without ever being blocked by any operation. Also the server prints out an information to the console window whenever a client is connected/disconnected to the server. Besides, all activity of the clients are written into a log file by the server.
There's no apparent problem when I look at the console windows. One second later after a client is disconnected, the information about that client is written to the console window of server. However when I look at the log file, it is seen that, the server is trying to send empty messages to all connected clients. But these messages are not displayed in clients' windows.
So it seems, the server is not properly closing the disconnected clients. The reader and writer streams of the disconnected client seems active even the client is disconnected.
How can this problem be solved according to the codes I've shared? By the way I am sharing the log file too. Here are the codes:
server.py
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import asyncio
import logging
logging.basicConfig(
filename="server.log",
format="- %(levelname)s - %(asctime)s - %(message)s",
level=logging.DEBUG,
datefmt="%d.%m.%Y %H:%M:%S"
)
class Server:
def __init__(self):
self.clients = []
def run(self):
asyncio.run(self.main())
async def client_connected(self, reader, writer):
client = f"{writer.get_extra_info('peername')}"
print(f"{client} is connected.")
logging.info(f"{client} is connected.")
self.clients.append((writer, reader))
while True:
try:
data = await reader.readline()
except (BrokenPipeError, ConnectionResetError):
data = "".encode()
await asyncio.sleep(1)
for i in self.clients:
msg = f"{client}: {data.decode()}"
try:
i[0].write(msg.encode())
logging.debug(msg[:-1])
await i[0].drain()
except (BrokenPipeError, ConnectionResetError):
i[0].close()
self.clients.remove(i)
print(f"{client} is disconnected.")
logging.info(f"{client} is disconnected.")
await asyncio.sleep(2)
break
async def main(self):
server = await asyncio.start_server(
client_connected_cb=self.client_connected,
host="127.0.0.1",
port=12345
)
print(f"Server started on {server.sockets[0].getsockname()}")
logging.info(f"Server started on {server.sockets[0].getsockname()}")
async with server:
await server.wait_closed()
if __name__ == "__main__":
Server().run()
client.py
#!/usr/bin/env python3.7
# -*- coding: utf-8 -*-
import sys
import asyncio
import threading
class Client:
def __init__(self):
self.nick = input("/nick ")
while not self.nick:
self.nick = input("/nick ")
def run(self):
asyncio.run(self.main())
async def read(self, reader, writer):
data = await reader.readline()
socket = writer.get_extra_info('socket').getsockname()
if str(socket) not in data.decode() or \
self.nick not in data.decode():
if data.decode().count("('") >= 1:
data = data.decode().split(": ")[-2:]
print(": ".join(data)[:-1])
async def write(self, writer):
t = threading.Thread(
target=lambda: writer.write(
f"{self.nick}: {sys.stdin.readline()}".encode()
)
)
t.daemon = True
t.start()
t.join(0.1)
await writer.drain()
async def main(self):
reader, writer = await asyncio.open_connection("127.0.0.1", 12345)
print(f"Connected to {writer.get_extra_info('peername')}")
while reader and writer:
await asyncio.gather(
self.read(reader, writer),
self.write(writer)
)
if __name__ == "__main__":
Client().run()
server.log
- DEBUG - 30.09.2019 15:17:50 - Using selector: EpollSelector
- INFO - 30.09.2019 15:17:50 - Server started on ('127.0.0.1', 12345)
- INFO - 30.09.2019 15:17:56 - ('127.0.0.1', 45562) is connected.
- INFO - 30.09.2019 15:18:05 - ('127.0.0.1', 45564) is connected.
- INFO - 30.09.2019 15:18:21 - ('127.0.0.1', 45566) is connected.
- DEBUG - 30.09.2019 15:18:48 - ('127.0.0.1', 45566): Client3: Hello Clients!
- DEBUG - 30.09.2019 15:18:48 - ('127.0.0.1', 45566): Client3: Hello Clients!
- DEBUG - 30.09.2019 15:18:48 - ('127.0.0.1', 45566): Client3: Hello Clients!
- DEBUG - 30.09.2019 15:18:51 - ('127.0.0.1', 45566): Client3: How are you?
- DEBUG - 30.09.2019 15:18:51 - ('127.0.0.1', 45566): Client3: How are you?
- DEBUG - 30.09.2019 15:18:51 - ('127.0.0.1', 45566): Client3: How are you?
- DEBUG - 30.09.2019 15:18:53 - ('127.0.0.1', 45566):
- DEBUG - 30.09.2019 15:18:53 - ('127.0.0.1', 45566):
- DEBUG - 30.09.2019 15:18:53 - ('127.0.0.1', 45566):
- DEBUG - 30.09.2019 15:18:53 - ('127.0.0.1', 45566):
- DEBUG - 30.09.2019 15:18:53 - ('127.0.0.1', 45566):
- DEBUG - 30.09.2019 15:18:53 - ('127.0.0.1', 45566):
- INFO - 30.09.2019 15:18:53 - ('127.0.0.1', 45566) is disconnected.
- DEBUG - 30.09.2019 15:18:55 - ('127.0.0.1', 45564):
- DEBUG - 30.09.2019 15:18:55 - ('127.0.0.1', 45564):
- DEBUG - 30.09.2019 15:18:55 - ('127.0.0.1', 45564):
- DEBUG - 30.09.2019 15:18:55 - ('127.0.0.1', 45564):
- INFO - 30.09.2019 15:18:55 - ('127.0.0.1', 45564) is disconnected.
- DEBUG - 30.09.2019 15:18:56 - ('127.0.0.1', 45566):
- DEBUG - 30.09.2019 15:18:57 - ('127.0.0.1', 45562):
- DEBUG - 30.09.2019 15:18:57 - ('127.0.0.1', 45562):
- INFO - 30.09.2019 15:18:57 - ('127.0.0.1', 45562) is disconnected.
According to the documentation of StreamWriter.close, it turns out you need to call wait_closed too:
stream.close()
await stream.wait_closed()
In your server code:
i[0].close()
await i[0].wait_closed()
I'm trying to deploy a custom version of VirtoCommerce to the Azure cloud and I'm having some trouble with it.
When I try to load the website i run into a
Server Error in '/' Application.
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond <ip>:9200
These are the last few lines of the SchedulerConsole log
[03/16/2015 17:45:23 > 62130d: INFO] VirtoCommerce.ScheduleService.Trace Error: 0 : VirtoCommerce.Scheduling.Jobs.GenerateSearchIndexWork#3e32cbe9-b912-4901-bedb-7604a4ab0616 Trace VirtoCommerce.Search.Providers.Elastic.ElasticSearchException: Failed to remove indexes. URL:xpmarket-search.cloudapp.net:9200 ---> PlainElastic.Net.OperationException: Unable to connect to the remote server ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 137.117.213.124:9200
[03/16/2015 17:45:23 > 62130d: INFO] at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
[03/16/2015 17:45:23 > 62130d: INFO] at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
[03/16/2015 17:45:23 > 62130d: INFO] --- End of inner exception stack trace ---
[03/16/2015 17:45:23 > 62130d: INFO] at System.Net.HttpWebRequest.GetResponse()
[03/16/2015 17:45:23 > 62130d: INFO] at PlainElastic.Net.ElasticConnection.ExecuteRequest(String method, String command, String jsonData)
[03/16/2015 17:45:23 > 62130d: INFO] --- End of inner exception stack trace ---
[03/16/2015 17:45:23 > 62130d: INFO] at PlainElastic.Net.ElasticConnection.ExecuteRequest(String method, String command, String jsonData)
[03/16/2015 17:45:23 > 62130d: INFO] at PlainElastic.Net.ElasticConnection.Delete(String command, String jsonData)
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Search.Providers.Elastic.ElasticClient`1.Delete(DeleteCommand deleteCommand) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Search\ElasticSearchProvider\ElasticClient.cs:line 129
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Search.Providers.Elastic.ElasticSearchProvider.RemoveAll(String scope, String documentType) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Search\ElasticSearchProvider\ElasticSearchProvider.cs:line 477
[03/16/2015 17:45:23 > 62130d: INFO] --- End of inner exception stack trace ---
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Search.Providers.Elastic.ElasticSearchProvider.ThrowException(String message, Exception innerException) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Search\ElasticSearchProvider\ElasticSearchProvider.cs:line 562
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Search.Providers.Elastic.ElasticSearchProvider.RemoveAll(String scope, String documentType) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Search\ElasticSearchProvider\ElasticSearchProvider.cs:line 490
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Foundation.Search.SearchIndexController.Prepare(String scope, String documentType, Boolean rebuild) in c:\Users\Tiago\Documents\xpmarketplace\src\Core\CommerceFoundation\Search\SearchIndexController.cs:line 91
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Scheduling.Jobs.GenerateSearchIndexWork.Execute(IJobContext context) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Jobs\VirtoCommerceJobs\GenerateSearchIndexWork.cs:line 17
[03/16/2015 17:45:23 > 62130d: INFO] at VirtoCommerce.Scheduling.JobActivityTool.ControlledExecution(IJobActivity activity, TraceContext traceContext, Action`1 audit, IDictionary`2 parameters) in c:\Users\Tiago\Documents\xpmarketplace\src\Extensions\Jobs\SchedulingLib\JobActivityTool.cs:line 32
[03/16/2015 17:45:23 > 62130d: INFO] VirtoCommerce.ScheduleService.Trace Stop: 0 : VirtoCommerce.Scheduling.Jobs.GenerateSearchIndexWork#3e32cbe9-b912-4901-bedb-7604a4ab0616 Finished with Error! Duration=0m. 21s. 66
[03/16/2015 17:45:27 > 62130d: INFO] VirtoCommerce.ScheduleService.Trace Verbose: 0 : TRACE|3/16/2015 5:45:27 PM|JobScheduler|SchedulerProcess-ApartmentIteration|||Iterating 5 Jobs
Looks like your Elastic Search Server is not running, can't open "137.117.213.124:9200". Which version of VC are you trying to deploy?
We had a small issue with not enough space allocated by default when elastic search was created. Here is the fix: https://github.com/VirtoCommerce/vc-community/commit/213de23cc023cc8da8983daba188d08c2de3c2a6
Basically make sue that size is set to the new value and redeploy elastic search.
I am trying to consume sharepoint webservices using apache httpcomponent client api.
I am able to perform a httpget and post authentication using ntlm. however attempting to post a request soap xml returns following error
Server was unable to process request. ---> Site is not configured for Claims Forms Authentication.
2014-05-22 07:57:36,241 [main] DEBUG http.wire - http-outgoing-0 >> "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.microsoft.com/sharepoint/soap/"> <soapenv:Header/> <soapenv:Body> <soap:Login> <soap:username>sansharma</soap:username> <soap:password>******</soap:password> </soap:Login> </soapenv:Body> </soapenv:Envelope>"
2014-05-22 07:57:42,141 [main] DEBUG http.wire - http-outgoing-0 << "HTTP/1.1 500 Internal Server Error[\r][\n]"
2014-05-22 07:57:42,142 [main] DEBUG http.wire - http-outgoing-0 << "Cache-Control: private[\r][\n]"
2014-05-22 07:57:42,142 [main] DEBUG http.wire - http-outgoing-0 << "Content-Type: text/xml; charset=utf-8[\r][\n]"
2014-05-22 07:57:42,142 [main] DEBUG http.wire - http-outgoing-0 << "Server: Microsoft-IIS/8.0[\r][\n]"
2014-05-22 07:57:42,142 [main] DEBUG http.wire - http-outgoing-0 << "X-AspNet-Version: 4.0.30319[\r][\n]"
2014-05-22 07:57:42,142 [main] DEBUG http.wire - http-outgoing-0 << "SPRequestGuid: e63e939c-895c-9011-4ed2-bbaeb1a6574b[\r][\n]"
2014-05-22 07:57:42,142 [main] DEBUG http.wire - http-outgoing-0 << "request-id: e63e939c-895c-9011-4ed2-bbaeb1a6574b[\r][\n]"
2014-05-22 07:57:42,143 [main] DEBUG http.wire - http-outgoing-0 << "X-FRAME-OPTIONS: SAMEORIGIN[\r][\n]"
2014-05-22 07:57:42,143 [main] DEBUG http.wire - http-outgoing-0 << "SPRequestDuration: 5485[\r][\n]"
2014-05-22 07:57:42,143 [main] DEBUG http.wire - http-outgoing-0 << "SPIisLatency: 1[\r][\n]"
2014-05-22 07:57:42,143 [main] DEBUG http.wire - http-outgoing-0 << "Persistent-Auth: false[\r][\n]"
2014-05-22 07:57:42,143 [main] DEBUG http.wire - http-outgoing-0 << "X-Powered-By: ASP.NET[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "MicrosoftSharePointTeamServices: 15.0.0.4420[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "X-Content-Type-Options: nosniff[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "X-MS-InvokeApp: 1; RequireReadOnly[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "Date: Thu, 22 May 2014 02:27:56 GMT[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "Content-Length: 443[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "[\r][\n]"
2014-05-22 07:57:42,144 [main] DEBUG http.wire - http-outgoing-0 << "<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>Server was unable to process request. ---> Site is not configured for Claims Forms Authentication.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>"
Is this a configuration issue. I am trying to invoke the authorization service with login operation.
regards
San Sharma