ASP.NET APP Works Only When The Query Is Executed From The Server
I have an application that queries a database hosted on a wind开发者_开发百科ows 2003 server. IIS appears to works fine because other applications work ok.
However, when I try to access this application from a remote machine I get an error.
I realized that the application starts working on the remote PCs when I execute a query from the server. Then the application works remotely.
Why is this happening? Is this a certificate problem? Does anybody have a clue?
Here is the exception
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] BH.Sysnet.DBHelper.SetSqlExceptionMessage(StringBuilder msg, Exception ex) +741 BH.Sysnet.DBHelper.CreateDbException(DB db, Exception ex) +68 BH.Sysnet.DB.ExecuteReturnDS(String sql, CommandType statementType, String nombreDataTable, DataSet ds) +206 BH.Sysnet.DB.ExecuteReturnDS(String sql, String nombreDataTable, DataSet ds) +15 BH.Sysnet.DB.ExecuteReturnDS(String sql, String nombreDataTable) +12 BH.Sysnet.DB.ExecuteReturnDS(String sql) +16 BH.GIDEWS.Pages.Log.Buscar() +1717 BH.GIDEWS.Pages.Log.btnBuscar_Click(Object sender, EventArgs e) +35 System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
Check you can see the appropriate port on the server from the remote machine - could this be a firewall configuration issue?
Next, confirm that you are able to connect to the database from the remote machine. Use whatever SQL command prompt tool is available, and see what happens... The idea here is to rule out Permissions issues - are you allowed to connect from the remote machine?
If you're able to do so, can you post the code that is failing, together with the output you are getting (full exception text if available...)
Martin.
精彩评论