Resolved as the cause of this problem, Is there a timeout setting in IIS.

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
It strangely exits the function at this (1)position. ====> as the cause of this problem, Is there a timeout setting in IIS.
Strangely, it exits from (1)position inside the try in the try catch statement.

***** I want IIS processing time to wait for the try catch statement in the picture below to finish processing.
Is there any way to control the time in IIS?


Response.Redirect("www.webip.com");
The other party came to the source of the picture below with the Response.Redirect("www.webip.com") command.

118.png



(2)Position function routine is as shown below.
119.png



I want IIS processing time to wait for the try catch statement in the picture above to finish processing.


The standby screen is short as shown below.

117.png
 

Attachments

  • 118.png
    118.png
    81.1 KB · Views: 8
  • 119.png
    119.png
    87.1 KB · Views: 6
Last edited:

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
Please post code as text in code tags, not as screenshots. They are very hard to read on small devices (and eat up a lot of bandwidth for those who have data limits). Additionally, if someone wants to help you by poking around with the code, you are forcing them to try to type the code from scratch. Help us help you by making things easier.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
ASP.NET (working with IIS) does have a page response time out, but it's set fairly long by default (2 minutes as I recall) before it terminates the request thread. So if you are debugging and stepping through your code, you will eventually get a page load time out if you are taking a long time dealing with your breakpoints.

In the case of the code you are showing above, I highly doubt that you are running into a time out issue. You maybe just facing multiple requests feeding into that same method and so it looks like you are not getting to the next line after instantiating your SqlHelper object because another request has come in and hitting your breakpoint again.

As an aside, using exception handling to do flow control is really a bad idea. You should only resort to it if you have no other choice -- looking at you .NET 4.8 version of MailAddress class. If you have options, actually inspect the values instead of letting the exception throw and immediately catch it. Exceptions are expensive, you want to avoid them if possible. With newer versions of C#, you could just use the null conditional operator (aka the Elvis operator) and null coalescing operators to simplify the logic:
C#:
m_connectionString = ConfigurationManager.ConnectionStrings?["envpedb"]?.ConnectionString ?? "default connection string here";

Without those operators you would have to do the inspection step by step:
C#:
m_connectionString = "default connection string here";
var connectionStrings = ConfigurationManager.ConnectionStrings;
if (connectionStrings != null)
{
    var connectionStringSettings = connectionStrings["envpedb"];
    if (connectionStringSettings != null)
    {
        if (!string.IsNullOrEmpty(connectionStringSettings.ConnectionString))
            m_connectionString = connectionStringSettings.ConnectionString;
    }
}
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
ASP.NET (working with IIS) does have a page response time out, but it's set fairly long by default (2 minutes as I recall) before it terminates the request thread. So if you are debugging and stepping through your code, you will eventually get a page load time out if you are taking a long time dealing with your breakpoints.

In the case of the code you are showing above, I highly doubt that you are running into a time out issue. You maybe just facing multiple requests feeding into that same method and so it looks like you are not getting to the next line after instantiating your SqlHelper object because another request has come in and hitting your breakpoint again.

As an aside, using exception handling to do flow control is really a bad idea. You should only resort to it if you have no other choice -- looking at you .NET 4.8 version of MailAddress class. If you have options, actually inspect the values instead of letting the exception throw and immediately catch it. Exceptions are expensive, you want to avoid them if possible. With newer versions of C#, you could just use the null conditional operator (aka the Elvis operator) and null coalescing operators to simplify the logic:
C#:
m_connectionString = ConfigurationManager.ConnectionStrings?["envpedb"]?.ConnectionString ?? "default connection string here";

Without those operators you would have to do the inspection step by step:
C#:
m_connectionString = "default connection string here";
var connectionStrings = ConfigurationManager.ConnectionStrings;
if (connectionStrings != null)
{
    var connectionStringSettings = connectionStrings["envpedb"];
    if (connectionStringSettings != null)
    {
        if (!string.IsNullOrEmpty(connectionStringSettings.ConnectionString))
            m_connectionString = connectionStringSettings.ConnectionString;
    }
}

Even as you said, the phenomenon in question is the same.
=======>
m_connectionString = "default connection string here";
var connectionStrings = ConfigurationManager.ConnectionStrings;
if (connectionStrings != null)
{
var connectionStringSettings = connectionStrings["envpedb"];
if (connectionStringSettings != null)
{
if (!string.IsNullOrEmpty(connectionStringSettings.ConnectionString))
m_connectionString = connectionStringSettings.ConnectionString;
}
}



Dynamic memory allocation with new <====== Strangely, it keeps exiting the function from the (Dynamic memory allocation with new ) position.
called as a Response.Redirect("http://www.webip.com") function.


Is there an association between function called as a Response.Redirect("http://www.webip.com") and (Dynamic memory allocation with new ) position function ?


In localhost mode, which checks by compiling and building with ASP.NET VS2015 Source, it works without any problems.
So I guess. There is no problem with the ASP.NET VS2015 Source. Because there is no problem when compiling, building, and running from ASP.NET VS2015 Source.

Please Help me. ㅠㅠ
 
Last edited:

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
No there is not an association between the two.

Use logging instead of stepping through code to verify your belief that the method is exiting when you call new on your SqlHelper object.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
No there is not an association between the two.

Use logging instead of stepping through code to verify your belief that the method is exiting when you call new on your SqlHelper object.


In my code, I see that the function exits from (Dynamic memory allocation with new ) position.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
How exactly did you see that? Were you stepping through the code with a debugger? Or do you have logging showing this?
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
An error message box was displayed.
120.png


121.png



below function code is called through Response.Redirect("www.webip.com").

is the whole function in question=====>
C#:
  public bool ConfirmLogin(string id, string pwd, ref string dbuserid, ref string username, ref string errmsg, ref string logstat, ref string updatedt, ref string lockFlg, ref int loginFailCnt)
        {
            string strQuery = string.Format("SELECT USER_ID, USER_PW_CD AS PWD, USER_NM, LOG_STATE, UPDATE_DATE, ISNULL(LOCK_FLAG,'N') AS LOCK_FLAG, " + "ISNULL(LOGIN_FAIL_CNT,0) AS LOGIN_FAIL_CNT FROM M_USER_CD (NOLOCK) WHERE UPPER(USER_ID)='{0}'", id);

            DataTable dt = null;
            bool boResult = true;
            try
            {
                errmsg = "SqlHelper Start Position";

                SqlHelper helper = new SqlHelper();

                errmsg = "SqlHelper End Position";

                if (helper == null)
                {
                    errmsg = "SqlHelper is null";
                    return false;
                }
 
                dt = helper.ExecuteDataTable(strQuery);

                if (dt == null)
                {
                    errmsg = "No Data";
                    return false;
                }

                dbuserid = dt.Rows[0]["USER_ID"].ToString();     
            }
            catch (Exception ex)
            {
                // errmsg = ex.Message;
                boResult = false;
            }
            return boResult;
        }

119.png
 
Last edited by a moderator:

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
And how do you know that an exception wasn't thrown as part of calling the the constructor for SqllHelper there by causing execution to go from lines 3 to 11 and then jump to the exception handler at line 31? Why not uncomment line 33 to see if what the exception was?
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
And how do you know that an exception wasn't thrown as part of calling the the constructor for SqllHelper there by causing execution to go from lines 3 to 11 and then jump to the exception handler at line 31? Why not uncomment line 33 to see if what the exception was?
Your Answer)Why not uncomment line 33 to see if what the exception was?
====>
in ex.Message Catch statement is called without message content.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
Then do ex.ToString() to get a full callstack to see what happened.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
As an aside, I finally got a closer look at one of your screenshots. I can't believe that you are sending the password in the clear (yikes) and in the URL (double yikes!). I hope that this is just prototype code and not production code that you are working on right now.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
As an aside, I finally got a closer look at one of your screenshots. I can't believe that you are sending the password in the clear (yikes) and in the URL (double yikes!). I hope that this is just prototype code and not production code that you are working on right now.
'/' The application has a server error.


style='font-size:10.0pt;font-family:"inherit","serif";color:#202124;mso-ansi-language:
EN'>The class is not registered.


An unhandled exception occurred while executing the current web request.

Review the stack trace for more information about the error you are getting and where the error is occurring in your code.

style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:
굴림;color:black'>. style='font-size:10.0pt;font-family:"inherit","serif";color:#202124;mso-ansi-language:
EN'>Exception information: System.Runtime.InteropServices.COMException: lang=EN style='font-size:10.0pt;font-family:"inherit","serif";color:#202124;
mso-ansi-language:EN'>The class is not registered.style='font-size:10.0pt;font-family:"inherit","serif";color:#202124'>
style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:
굴림;color:black'>



The class is not registered.lang=EN-US style='font-size:10.0pt;font-family:"inherit","serif";color:#202124'>
style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:
굴림;color:black'>

source errorstyle='font-size:10.0pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
굴림;mso-bidi-font-family:Arial;color:black'>:
style='font-size:10.0pt;font-family:"Arial","sans-serif";mso-fareast-font-family:
굴림;color:black'>

줄 105: public bool ConfirmLogin(string id, string pwd, ref string dbuserid, ref string username, ref string errmsg, ref string logstat, ref string updatedt, ref string lockFlg, ref int loginFailCnt)
줄 106: {
줄 107: SqlHelper helper = new SqlHelper(); ç=======================Dynamic Memory Allocation
줄 108:
줄 109:​

소스 파일: D:\업무\1.프로그램\UlsanPE_211220\UlsanPE.BZ.CC\Login_nTx.cs 줄: 107

스택 추적:

style='font-size:10.0pt;color:black'>[COMException (0x80040154): lang=EN style='font-size:10.0pt;font-family:"inherit","serif";color:#202124;
mso-ansi-language:EN'>The class is not registered. style='font-size:10.0pt;color:black'>]
System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) +0
System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +352
System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType) +197
System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(RuntimeType serverType, Object[] props, Boolean bNewObj) +14427504
UlsanPE.BZ.CC.Login_nTx.ConfirmLogin(String id, String pwd, String& dbuserid, String& username, String& errmsg, String& logstat, String& updatedt, String& lockFlg, Int32& loginFailCnt) in D:\업무\1.프로그램\UlsanPE_211220\UlsanPE.BZ.CC\Login_nTx.cs:107
UlsanPEWebApp.Default.imgbtnLogin(String id, String pw) in D:\업무\1.프로그램\UlsanPE_211220\UlsanPEWebApp\Default.aspx.cs:212
UlsanPEWebApp.Default.Page_Load(Object sender, EventArgs e) in D:\업무\1.프로그램\UlsanPE_211220\UlsanPEWebApp\Default.aspx.cs:54
System.Web.UI.Control.OnLoad(EventArgs e) +108
System.Web.UI.Control.LoadRecursive() +90
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1533​



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.0
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
Please post the actual text instead of the results of "view source". If you are going to post the results of view source, be sure to put the result is code tags (it's the icon on the tool bar that looks like </>). Right now you post #12 just looks like junk because some of the HTML got stripped away by the forum software.

I though that there was no ex.Message? Seems to me that "The class is not registered" should have shown up as part of the exception message.

It looks like your SqlHelper is some kind of object that is based on a COM object, and that COM object is not registered.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
Please post the actual text instead of the results of "view source". If you are going to post the results of view source, be sure to put the result is code tags (it's the icon on the tool bar that looks like </>). Right now you post #12 just looks like junk because some of the HTML got stripped away by the forum software.

I though that there was no ex.Message? Seems to me that "The class is not registered" should have shown up as part of the exception message.

It looks like your SqlHelper is some kind of object that is based on a COM object, and that COM object is not registered.
123.png



I get the same error even after registering(UlsanPE.FW.Data.SqlHelper)
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
Are you compiling and registering the code as 64-bit? As I recall VS2015's "Any CPU" setting would prefer 32-bit, because VS2015 itself would run as 32-bit. Also, by default app pools in IIS would run as 64-bit. In general, 32-bit COM DLL servers will not load in 64-bit processes.
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
Are you compiling and registering the code as 64-bit? As I recall VS2015's "Any CPU" setting would prefer 32-bit, because VS2015 itself would run as 32-bit. Also, by default app pools in IIS would run as 64-bit. In general, 32-bit COM DLL servers will not load in 64-bit processes.
130.png



131.png
 

yunhyejeong

Well-known member
Joined
Dec 5, 2021
Messages
135
Programming Experience
1-3
Are you compiling and registering the code as 64-bit? As I recall VS2015's "Any CPU" setting would prefer 32-bit, because VS2015 itself would run as 32-bit. Also, by default app pools in IIS would run as 64-bit. In general, 32-bit COM DLL servers will not load in 64-bit processes.
you are very smart.
You were right.
I did what you taught me. So the problem was solved.
You are very Smart.
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,085
Location
Chesapeake, VA
Programming Experience
10+
You could have narrowed down this problem sooner to the information in post #17 if you had logging for your classes as well as a global exception handler to application wide errors.
 
Top Bottom