发布我的asp.net Web应用程序时出现异常

时间:2015-03-18 10:21:36

标签: c# asp.net iis-7

当我在iis 7服务器中部署我的Web应用程序时,有人试图通过使用固定IP的远程PC来访问它。

这是错误:

Hôte inconnu

Description : Une exception non gérée s'est produite au moment de l'exécution de la requête Web actuelle. Contrôlez la trace de la pile pour plus d'informations sur l'erreur et son origine dans le code. 

Détails de l'exception: System.Net.Sockets.SocketException: Hôte inconnu

Erreur source: 


Ligne 10 :     Layout = null;
Ligne 11 :     string Language = Xml_Doc_Langue.Instance.GetDefaultLanguage();
Ligne 12 :  if (string.IsNullOrEmpty(Constante.Instance.path))
Ligne 13 :     { 
Ligne 14 :         Constante.Instance.path = Server.MapPath("~");

Fichier source : c:\NextCare_1203\Views\StartPage\Authentication.cshtml    Ligne : 12 

Trace de la pile: 


[SocketException (0x2af9): Hôte inconnu]
   System.Net.Dns.InternalGetHostByAddress(IPAddress address, Boolean includeIPv6) +3186164
   System.Net.Dns.GetHostEntry(String hostNameOrAddress) +8657018
   ClinicManagement.Constante.GetClientHostName() +128
   ClinicManagement.Constante..cctor() +2690

[TypeInitializationException: Une exception a été levée par l'initialiseur de type pour 'ClinicManagement.Constante'.]
   ClinicManagement.Constante.get_Instance() +100
   ASP._Page_Views_StartPage_Authentication_cshtml.Execute() in c:\NextCare_1203\Views\StartPage\Authentication.cshtml:12
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy() +280
   System.Web.Mvc.WebViewPage.ExecutePageHierarchy() +126
   System.Web.WebPages.StartPage.ExecutePageHierarchy() +143
   System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) +181
   System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +378
   System.Web.Mvc.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17() +33
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +854940
   System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +265
   System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +839412
   System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +28
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +65
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +51
   System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +42
   System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +15
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +51
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +606
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288

我检查Constant(class)中的path(attribut)是null还是空

这是我的班级代码:

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 string path = System.AppDomain.CurrentDomain.BaseDirectory;
                public string nxtDemiLine = "<div class='DemiLine'></div>";
                public string nxtLine = "<div class='Line'></div>";
                public string nxtLine10 = "<div class='Line10'></div>";
                public string nxtLine25 = "<div class='Line25'></div>";
                public string nxtLine50 = "<div class='Line50'></div>";
                public string nxtHRgreen = "<hr width='100%' noshade size='2' style='border-color:green'>";
                public string nxtHRred = "<hr width='100%' noshade size='1' style='border-color:red'>";
                public string nxtEspace = "&nbsp;";

    .........
    }
    }

1 个答案:

答案 0 :(得分:1)

因此,似乎类ClinicManagement.Constante的静态构造函数正在尝试发出HTTP请求,并且失败了,因为它尝试连接的主机名没有DNS条目。