当我从远方客户打电话给我的web应用程序SocketException被抛出 [英] SocketException is thrown when i call my web application from distance client
问题描述
我正在下面的asp.net MVC架构的项目。我创建了一个静态类中,我定义的所有稍后将在我的应用程序的不同文件被调用的属性和方法Constante.cs。
Constante.cs
使用系统;
使用System.Collections.Generic;
使用System.Linq的;
使用System.Text;
使用System.Net.Mail;
使用System.Net;
使用System.Data.SqlClient的;
使用System.Data这;
使用的System.Web;使用System.Web.Mvc;
使用System.IO;
System.Collections中使用;
使用的System.Xml;
使用System.Net.NetworkInformation;
使用的System.Net.Sockets;
使用System.Security.Cryptography;
使用System.ComponentModel;
使用ClinicManagement.Models;
使用System.Web.Script.Serialization;
使用Newtonsoft.Json;
使用System.Xml.Linq的;
使用System.Data.Entity的;
使用System.Data.Entity.Infrastructure;
使用System.Data.Objects;
使用系统codeDom.Compiler。
使用Microsoft.CSharp;
使用的System.Reflection;
使用System.Configuration;
使用System.Drawing中;
使用System.Web.WebPages;使用NextGrH.Areas.GrH //;
使用ClinicManagement.OurTypeBatch;
使用ClinicManagement.Manager.CaseManager;
使用ClinicManagement.Areas.Accounting.Models;
命名空间ClinicManagement
{
公共类康斯坦特
{
私有静态实例,康斯坦特;
公共静态实例康斯坦特
{
得到
{
对象永乐=新的对象();
锁(永乐)
{
如果(例如== NULL)
例如=新康斯坦特();
返回实例;
}
}
}
公共静态NXT_USER的currentUser
{
得到
{
返回GetCurrentUser();
}
} //年龄患者的Assurant
公共静态INT AgePatient = 18;
公共静态INT GridViewRowHeight = 25;
公共静态INT FilterBarHeight = 27; //表:LA豪特FiltreRow
公共静态INT GroupPanelHeight = 25; //表:分组
公共静态INT GroupPanelMargin = 15; //表:保证金集团通过
公共静态INT HeadHeight = 30;
公共静态INT HeightSearch = 21; //表:搜索网格 //添加k.c
公共静态INT拼箱= 6;
公共静态小数TIMBRE = 0.5M;
//添加k.c
//公共静态INT MenuHeight = 30; //他们标准
公共静态INT MenuHeight = 30; 公共静态INT MenuButtonHeight = 39; //工具栏:拉豪特杜菜单
公共静态INT MenuButtonMargin = 20; //工具栏:拉豪特杜菜单
公共静态INT FooterHeight = 30;
私有静态诠释保证金= 250;
公共静态字符串路径= System.AppDomain.CurrentDomain.BaseDirectory;
公共静态字符串nxtDemiLine =< DIV CLASS ='DemiLine'>< / DIV>中;
公共静态字符串nxtLine =< DIV CLASS ='行'>< / DIV>中;
公共静态字符串nxtLine10 =< DIV CLASS =Line10'>< / DIV>中;
公共静态字符串nxtLine25 =< DIV CLASS =Line25'>< / DIV>中;
公共静态字符串nxtLine50 =< DIV CLASS =Line50'>< / DIV>中;
公共静态字符串nxtHRgreen =< HR WIDTH =100%noshade大小='2'风格='边框颜色:绿色>中;
公共静态字符串nxtHRred =< HR WIDTH =100%noshade大小='1'风格='边框颜色:红色'>中;
公共静态字符串nxtEspace =&放大器; NBSP;;
私人静态对象[] GetParamsPassedOpservation()
{
[对象] paramsPassedOpservation =新对象[2];
VAR_OPER_REQ [0] =加上;
VAR_OPER_REQ [1] =s_grid_12;
paramsPassedOpservation [0] = FORM_OBSERVATION;
paramsPassedOpservation [1] = VAR_OPER_REQ;
返回paramsPassedOpservation;
}
私人静态字符串GetCurrentLanguage()
{
如果(HttpContext.Current.Session [CurrentLanguage]!= NULL) 返回HttpContext.Current.Session [CurrentLanguage]的ToString()。
其他
返回;
}
私有静态诠释GetWidthScreen()
{
如果(HttpContext.Current.Session [WidthScreen]!= NULL) 返回int.Parse(HttpContext.Current.Session [WidthScreen]的ToString());
其他
返回0;
}
私有静态诠释GetHeightScreen()
{
如果(HttpContext.Current.Session [HeightScreen]!= NULL) 返回int.Parse(HttpContext.Current.Session [HeightScreen]的ToString());
其他
返回0;
}
私有静态NXT_USER GetCurrentUser()
{
如果(HttpContext.Current.Session [的currentUser]!= NULL) 回报(NXT_USER)HttpContext.Current.Session [的currentUser];
其他
返回新NXT_USER();
}
}
}
现在一切都很好,但是当我在远程服务器上部署应用,有人试图通过一个固定的IP地址访问,则抛出异常。
这通常是主机名解析过程发生,并且意味着本地服务器没有从权威服务器的响应临时误差
块引用>这是我的错误的地方:
利涅193:@ {
利涅194:WriteLiteral(Constante.nxtDemiLine);
利涅195:WriteLiteral(Constante.nxtLine);
利涅196:}
解决方案这看起来像你的网络服务器未能查找客户端的主机名(或中间代理) - 如果关闭主机名解析,它应该是反应更灵敏。
I'm working on a project that follows the asp.net mvc architecture. I create a static class " Constante.cs " in which I defined all the attributes and methods that will be called later in different files of my application.
Constante.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Mail; using System.Net; using System.Data.SqlClient; using System.Data; using System.Web; using System.Web.Mvc; using System.IO; using System.Collections; using System.Xml; using System.Net.NetworkInformation; using System.Net.Sockets; using System.Security.Cryptography; using System.ComponentModel; using ClinicManagement.Models; using System.Web.Script.Serialization; using Newtonsoft.Json; using System.Xml.Linq; using System.Data.Entity; using System.Data.Entity.Infrastructure; using System.Data.Objects; using System.CodeDom.Compiler; using Microsoft.CSharp; using System.Reflection; using System.Configuration; using System.Drawing; using System.Web.WebPages; //using NextGrH.Areas.GrH; using ClinicManagement.OurTypeBatch; using ClinicManagement.Manager.CaseManager; using ClinicManagement.Areas.Accounting.Models; namespace ClinicManagement { public class Constante { private static Constante instance; public static Constante Instance { get { Object lok = new object(); lock (lok) { if (instance == null) instance = new Constante(); return instance; } } } public static NXT_USER CurrentUser { get { return GetCurrentUser(); } } //age Patient assurant public static int AgePatient = 18; public static int GridViewRowHeight = 25; public static int FilterBarHeight = 27; // Table: la Hauteur FiltreRow public static int GroupPanelHeight = 25; // Table : Group By public static int GroupPanelMargin = 15; // Table : Margin Group By public static int HeadHeight = 30; public static int HeightSearch = 21; // Table : Search In Grid //added k.c public static int groupage = 6; public static decimal TIMBRE = 0.5M; //added k.c //public static int MenuHeight = 30;//them standard public static int MenuHeight = 30; public static int MenuButtonHeight = 39; //Toolbar : la Hauteur du Menu public static int MenuButtonMargin = 20; //Toolbar : la Hauteur du Menu public static int FooterHeight = 30; private static int margin = 250; public static string path = System.AppDomain.CurrentDomain.BaseDirectory; public static string nxtDemiLine = "<div class='DemiLine'></div>"; public static string nxtLine = "<div class='Line'></div>"; public static string nxtLine10 = "<div class='Line10'></div>"; public static string nxtLine25 = "<div class='Line25'></div>"; public static string nxtLine50 = "<div class='Line50'></div>"; public static string nxtHRgreen = "<hr width='100%' noshade size='2' style='border-color:green'>"; public static string nxtHRred = "<hr width='100%' noshade size='1' style='border-color:red'>"; public static string nxtEspace = " "; private static object[] GetParamsPassedOpservation() { object[] paramsPassedOpservation = new object[2]; VAR_OPER_REQ[0] = "add"; VAR_OPER_REQ[1] = "s_grid_12"; paramsPassedOpservation[0] = FORM_OBSERVATION; paramsPassedOpservation[1] = VAR_OPER_REQ; return paramsPassedOpservation; } private static string GetCurrentLanguage() { if (HttpContext.Current.Session["CurrentLanguage"] != null) return HttpContext.Current.Session["CurrentLanguage"].ToString(); else return ""; } private static int GetWidthScreen() { if (HttpContext.Current.Session["WidthScreen"] != null) return int.Parse(HttpContext.Current.Session["WidthScreen"].ToString()); else return 0; } private static int GetHeightScreen() { if (HttpContext.Current.Session["HeightScreen"] != null) return int.Parse(HttpContext.Current.Session["HeightScreen"].ToString()); else return 0; } private static NXT_USER GetCurrentUser() { if (HttpContext.Current.Session["CurrentUser"] != null) return (NXT_USER)HttpContext.Current.Session["CurrentUser"]; else return new NXT_USER(); } } }
For now everything is fine, but when I deploy my application on a remote server and someone try to access through a fixed IP address , an exception is thrown
This is usually a temporary error that occurs during the resolution of the host name and means that the local server did not receive a response from an authoritative server
And this is the place of my error:
Ligne 193 : @{ Ligne 194 : WriteLiteral(Constante.nxtDemiLine); Ligne 195 : WriteLiteral(Constante.nxtLine); Ligne 196 : }
解决方案This looks like your webserver is failing to look up the hostname of the client (or an intermediate proxy) - if you turn off host name resolution, it should be more responsive.
这篇关于当我从远方客户打电话给我的web应用程序SocketException被抛出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!