我在Windows Azure中尝试过一些实验室,它运行正常.所以,我开始使用Azure Emulator开发我的应用程序.
我今天在Windows Azure中执行了我的第一个部署测试并且遇到了第一个问题:
No connection could be made because the target machine actively refused it 127.0.0.1:10000
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:10000
Source Error:
An unhandled exception was generated during the execution of the current web request. …Run Code Online (Sandbox Code Playgroud) 这是一个非常具体的问题.我设法通过使用名为EmailAddress.cshtml,保存在~/Views/Shared/EditorTemplates/文件夹中的编辑器模板自动将占位符属性添加到html5电子邮件输入类型.请参阅以下代码:
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, new { @class = "text-box single-line", placeholder = ViewData.ModelMetadata.Watermark })
Run Code Online (Sandbox Code Playgroud)
它的工作原理是因为我[DataType(DataType.EmailAddress)]在视图模型中使用了DataAnnotation.
什么不起作用是我使用int?变量.
public class MiageQuotaRequestViewModel
{
[Required]
[DataType(DataType.EmailAddress)]
[Display(Name = "Nombre de place demandées", Prompt = "Nombre de place")]
[Range(0, 50, ErrorMessage = "La demande doit être comprise entre 0 et 50 places")]
public int? RequestedQuota { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
@Html.EditorFor 像这样翻译这个输入:
<input class="text-box single-line" data-val="true" data-val-number="The field Nombre de place demandées must be a number." data-val-range="La demande …Run Code Online (Sandbox Code Playgroud) c# placeholder mvc-editor-templates data-annotations asp.net-mvc-4
我正在使用RMI开发一个Java游戏,用于所有网络通信.RMI允许我在我的服务器上调用方法,但这对我来说还不够.我还希望服务器能够在连接的客户端之间传播消息.
我的客户查找服务器(它的接口扩展了Remote)并在其上注册.它允许服务器知道谁连接.我的客户还实现了一个扩展Remote的接口.这是我的代码的一部分:
接口声明:
public interface IServer extends Remote {
void connect(IClient Client) throws RemoteException, ExistingItemException;
//...
}
public interface IClient extends Remote {
public void notify(Notification Notification) throws RemoteException;
//...
}
Run Code Online (Sandbox Code Playgroud)
服务器端:
//int RMIPort = 1099, ServerPort = 1100;
IServer Server = new RMIServer();
IServer Proxy = (IServer) UnicastRemoteObject.exportObject(Server, ServerPort);
LocateRegistry.createRegistry(RMIPort).rebind("//" + LocalIP + ":" +
RMIPort + "/xxx", Proxy);
Run Code Online (Sandbox Code Playgroud)
客户端:
//Sets the local reference to IServer and creates the IClient
setInstance(new Client(Login, (IServer) LocateRegistry.getRegistry(RemoteIP).
lookup("//" + RemoteIP + ":" …Run Code Online (Sandbox Code Playgroud)