Microsoft에서 여기에서 찾을 수있는 채팅용 웹 응용 프로그램을 만드는 방법에 대한 자습서를 제공합니다. https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr#setup(C#) SignalR 2.2.2 - 프로젝트가 VS (하위 2017)에서 VS 2017로 전송되는 문제
설치 프로그램은 매우 간단하지만 최신 버전의 업데이트와 호환되는 코드 버전은 까다 롭습니다. 필자가 언급 한 한 가지 사실은 사용자에게 이름을 입력하라는 메시지가 팝업으로 표시되는 것입니다. 이 난을하기 위해이 함께 HTML 코드를 부여 치환 :
<title>SignalR Simple Chat</title>
<style type="text/css">
.container {
background-color: #99CCFF;
border: thick solid #808080;
padding: 20px;
margin: 20px;
}
</style>
<div class="container">
<input type="text" id="message" />
<input type="button" id="sendmessage" value="Send" />
<input type="hidden" id="displayname" />
<ul id="discussion"></ul>
</div>
<script src="scripts/jquery-1.6.4.js"></script>
<script src="scripts/jquery.signalR-2.2.2.js"></script>
<!--Add script to update the page and send messages.-->
<script type="text/javascript">
$(function() {
var connection = $.hubConnection();
var chat = connection.createHubProxy('chatHub');
// Declare a proxy to reference the hub.
//var chat = $.connection.chatHub;
// Create a function that the hub can call to broadcast messages.
chat.on('broadcastMessage', function (name, message) {
// Html encode display name and message.
var encodedName = $('<div />').text(name).html();
var encodedMsg = $('<div />').text(message).html();
// Add the message to the page.
$('#discussion').append('<li><strong>' + encodedName
+ '</strong>: ' + encodedMsg + '</li>');
});
// Get the user name and store it to prepend to messages.
$('#displayname').val(prompt('Enter your name:', ''));
// Set initial focus to message input box.
$('#message').focus();
connection.start(function() {
$('#sendmessage').click(function() {
// Call the Send method on the hub.
chat.invoke('Send', $('#displayname').val(), $('#message').val());
// Clear text box and reset focus for next comment.
$('#message').val('').focus();
});
});
});
</script>
이것은 팝업 창이 표시 될 때까지 가능한 것으로 보입니다. 그러나 디스플레이 박스에서 사용자의 실제 출력을 보는 것만 큼 보내기 버튼을 누를 때 아무 것도 보이지 않습니다. 또한 새로운 HTML 코드는 VS 2017 프로그래머가 "보내기"버튼을 클릭 할 때 대화방을 비울 수있는 것처럼 보입니다. 누구든지이 간단한 응용 프로그램에서 최신이 아닌 것을 발견 할 수 있습니까?
이 내 대답이 문제를 해결할 수 있는지를 나는이 사건의 경우 알고하지 않습니다 SignalR 또는 뭔가 업데이트 문제 ...
idk 왜 아무 것도 작동하지 않습니다. –