Debian Server.exe错误

时间:2014-04-11 15:39:10

标签: linux vb.net debian

当我在聊天服务器上加入我的客户端时。服务器给我这个错误:

  

Der Server l?uft!
  jakk已加入。

     

缺少方法SetProjectError   汇编/var/www/Server.exe,输入   Microsoft.VisualBasic.CompilerServices.ProjectData

     

未处理的异常:System.IO.FileNotFoundException:无法加载   文件或程序集' Microsoft.VisualBasic,Version = 10.0.0.0,   Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'或其中一个   依赖。文件名:' Microsoft.VisualBasic,Version = 10.0.0.0,   Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a'在   Server.Module1。 Lambda $ _1(System.Object a0)[0x00000] in:0 in System.Threading.Thread.StartInternal()[0x00000] in   :0 [错误]致命未处理例外:   System.IO.FileNotFoundException:无法加载文件或程序集   ' Microsoft.VisualBasic,Version = 10.0.0.0,Culture = neutral,   公钥= b03f5f7f11d50a3a'或其中一个依赖项。文件   name:' Microsoft.VisualBasic,Version = 10.0.0.0,Culture = neutral,   公钥= b03f5f7f11d50a3a'在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

1 个答案:

答案 0 :(得分:1)

我只能假设你试图在mono上运行vb.net应用程序,因为你有linux和debian标签。你安装了https://packages.debian.org/sid/all/libmono-microsoft-visualbasic10.0-cil吗?