Skip to content
Advertisement

Debian Server.exe Error

When i join with my client on my chat-server. The server gives me this error:

Der Server l?uft!
jakk has joined.

Missing method SetProjectError in assembly /var/www/Server.exe, type Microsoft.VisualBasic.CompilerServices.ProjectData

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. File name: ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ at Server.Module1.Lambda$_1 (System.Object a0) [0x00000] in :0 at System.Threading.Thread.StartInternal () [0x00000] in :0 [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. File name: ‘Microsoft.VisualBasic, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ at Server.Module1.Lambda$_1 (System.Object a0) [0x00000] in :0 at System.Threading.Thread.StartInternal () [0x00000] in :0

Server.exe

Imports System.Net.Sockets
Imports System.IO
Imports System.Net

' TCP-MultiServer 
' C 2009 - Vincent Casser

Module Module1
    Private server As TcpListener
    Private client As New TcpClient
    Private ipendpoint As IPEndPoint = New IPEndPoint(IPAddress.Any, 8000) ' eingestellt ist port 8000. dieser muss ggf. freigegeben sein!
    Private list As New List(Of Connection)

    Private Structure Connection
        Dim stream As NetworkStream
        Dim streamw As StreamWriter
        Dim streamr As StreamReader
        Dim nick As String ' natürlich optional, aber für die identifikation des clients empfehlenswert.
    End Structure

    Private Sub SendToAllClients(ByVal s As String)
        For Each c As Connection In list ' an alle clients weitersenden.
            Try
                c.streamw.WriteLine(s)
                c.streamw.Flush()
            Catch
            End Try
        Next
    End Sub

    Sub Main()
        Console.WriteLine("Der Server läuft!")
        server = New TcpListener(ipendpoint)
        server.Start()

        While True ' wir warten auf eine neue verbindung...
            client = server.AcceptTcpClient

            Dim c As New Connection ' und erstellen für die neue verbindung eine neue connection...
            c.stream = client.GetStream
            c.streamr = New StreamReader(c.stream)
            c.streamw = New StreamWriter(c.stream)

            c.nick = c.streamr.ReadLine ' falls das mit dem nick nicht gewünscht, auch diese zeile entfernen.

            list.Add(c) ' und fügen sie der liste der clients hinzu.
            Console.WriteLine(c.nick & " has joined.")
            SendToAllClients(c.nick & " has joined.")
            ' falls alle anderen das auch lesen sollen können, an alle clients weiterleiten. siehe SendToAllClients

            Dim t As New Threading.Thread(AddressOf ListenToConnection)
            t.Start(c)
        End While
    End Sub

    Private Sub ListenToConnection(ByVal con As Connection)
        Do
            Try
                Dim tmp As String = con.streamr.ReadLine ' warten, bis etwas empfangen wird...
                Console.WriteLine(con.nick & ": " & tmp)
                SendToAllClients(con.nick & ": " & tmp) ' an alle clients weitersenden.

            Catch ' die aktuelle überwachte verbindung hat sich wohl verabschiedet.
                list.Remove(con)
                Console.WriteLine(con.nick & " has exit.")
                SendToAllClients(con.nick & " has exit.")
                Exit Do
            End Try
        Loop
    End Sub
End Module

Client.exe

Imports System.Net.Sockets
Imports System.IO

Public Class Form1
    Private stream As NetworkStream
    Private streamw As StreamWriter
    Private streamr As StreamReader
    Private client As New TcpClient
    Private t As New Threading.Thread(AddressOf Listen)
    Private Delegate Sub DAddItem(ByVal s As String)
    Private nick As String = "unknown"
    Private serverip As String = "127.0.0.1"

    Private Sub AddItem(ByVal s As String)
        ListBox1.Items.Add(s)
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

    End Sub
    Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        Try
            client.Connect(serverip, 8000) ' hier die ip des servers eintragen. 
            ' da dieser beim testen wohl lokal läuft, hier die loopback-ip 127.0.0.1.
            If client.Connected Then
                Label1.Text = "Verbunden!"
                Label1.ForeColor = Color.Green
                Button1.Enabled = True
                TextBox1.Enabled = True
                Button2.Enabled = False
                stream = client.GetStream
                streamw = New StreamWriter(stream)
                streamr = New StreamReader(stream)

                streamw.WriteLine(nick) ' das ist optional.
                streamw.Flush()

                t.Start()
            Else
                'MessageBox.Show("Verbindung zum Server nicht möglich!")
                'Application.Exit()
                Label1.Text = "Verbindung zum Server nicht möglich!"
                Label1.ForeColor = Color.Red
                Button1.Enabled = False
                TextBox1.Enabled = False
                Button2.Enabled = True
            End If
        Catch ex As Exception
            'MessageBox.Show("Verbindung zum Server nicht möglich!")
            'Application.Exit()
            Label1.Text = "Verbindung zum Server nicht möglich!"
            Label1.ForeColor = Color.Red
            Button1.Enabled = False
            TextBox1.Enabled = False
            Button2.Enabled = True
        End Try
    End Sub

    Private Sub Listen()
        While client.Connected
            Try
                Me.Invoke(New DAddItem(AddressOf AddItem), streamr.ReadLine)
            Catch
                Label1.Text = "Verbindung zum Server nicht möglich!"
                Label1.ForeColor = Color.Red
                Button1.Enabled = False
                TextBox1.Enabled = False
                Button2.Enabled = True
            End Try
        End While
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        streamw.WriteLine(TextBox1.Text)
        streamw.Flush()
        TextBox1.Clear()
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        nick = InputBox("Nickname: ", "Namen festlegen", "unknown")
        serverip = InputBox("Server IP: ", "Server IP", "127.0.0.1")
    End Sub


End Class

Advertisement

Answer

I can only assume that you are attempting to run a vb.net application on mono since you have linux and debian tags. Do you have https://packages.debian.org/sid/all/libmono-microsoft-visualbasic10.0-cil installed?

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement