0

An Exception is catched when i deploy my web application in iis 7 server, and someone try to reach it from a distante PC using a fixed IP.

this is the error:

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

I check if path (attribut) in Constant ( class ) is null or empty

And this is the code of my class Constant:

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;";

    .........
    }
    }
3
  • Please add the code in the static constructor of ClinicManagement.Constante to your question. It's highly relevant. It should look something like public static Constante(){... Commented Mar 18, 2015 at 10:35
  • I didn't understand you coud you please clarify your comment :) Commented Mar 18, 2015 at 10:39
  • 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 string path; Commented Mar 18, 2015 at 10:41

1 Answer 1

1

So, it appears that the static constructor of class ClinicManagement.Constante is attempting to make an HTTP request, and that is failing because the hostname that it is trying to connect to has no DNS entry.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer, so what is the solution
now i get this error "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"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.