当我从远程客户端调用我的Web应用程序时抛出SocketException

时间:2015-03-24 08:58:22

标签: c# asp.net asp.net-mvc iis-7 windows-server-2008-r2

我正在开发一个遵循asp.net mvc架构的项目。我创建了一个静态类“Constante.cs”,其中我定义了稍后将在我的应用程序的不同文件中调用的所有属性和方法。

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 = "&nbsp;";
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();
        }
}
}

现在一切都很好,但是当我在远程服务器上部署我的应用程序并且有人试图通过固定IP地址访问时,会抛出异常

  

这通常是在解析主机名期间发生的临时错误,意味着本地服务器未收到来自权威服务器的响应

这是我错误的地方:

Ligne 193 :  @{
Ligne 194 :      WriteLiteral(Constante.nxtDemiLine);
Ligne 195 :   WriteLiteral(Constante.nxtLine);
Ligne 196 :  }

1 个答案:

答案 0 :(得分:0)

这看起来像您的网络服务器无法查找客户端(或中间代理)的主机名 - 如果您关闭主机名解析,它应该更具响应性。