Crystal Report logon failed in IIS 7 - c#

I have used crystal report with VS2010 with IIS 7. I can connect the DB from WEB application. However, it throws "Logon Failed", if the application run with IIS 7.
I tried with following VB.NET code
Dim boConnectionInfo As New ConnectionInfo()
boConnectionInfo.ServerName = ConfigurationManager.AppSettings("CRServerName").ToString
boConnectionInfo.DatabaseName = ConfigurationManager.AppSettings("CRDatabaseName").ToString
boConnectionInfo.UserID = ConfigurationManager.AppSettings("CRUserID").ToString
boConnectionInfo.Password = ConfigurationManager.AppSettings("CRPassword").ToString
boReportDocument.VerifyDatabase()
boReportDocument.Refresh()
it throws following exceptions
Log on failed.
at
CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase()
at IPSReport.btnViewPort_Click(Object sender, EventArgs e) in
C:\inetpub\wwwroot\IPS_CrysRpt_VS2010\Report.aspx.vb:line 383 at
System.Web.UI.WebControls.Button.OnClick(EventArgs e) at
System.Web.UI.WebControls.Button.RaisePostBackEvent(String
eventArgument) at
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) at
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Could you please help me out to find the cause of error and solutions for it?
Thanks
VG

You haven't ascertained whether the values being read from the Web.Config file via the AppSettings static class are the values you expect them to be.
If by saying "I can connect the DB from WEB application." you mean "I can connect to the database inside Visual Studio but my application won't connect when deployed and running under IIS" then the answer is that the connection settings being read by the application when you deploy it under IIS are not the same as the credentials you are using when you connect in Visual Studio. Typically this is because you haven't deployed the Web.Config containing the credentials correctly.
To determine whether this is true; (1) look at the contents of the Web.Config you have deployed on IIS, (2) output the credentials you are reading during your connection attempt using some logging framework (or just write them as the HTML output). You will probably find they are not the credentials you think they are.

Related

OracleConnection.Open() not working in ASP.NET

I have a VC# application that tries to open an Oracle database, but when it calls OracleConnection.Open(), it throws, "Attempted to read or write protected memory."
Here is the stack trace of the error:
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Oracle.DataAccess.Client.OpsCon.Open1(IntPtr& opsConCtx, IntPtr& opsErrCtx, OpoConValCtx* pOpoConValCtx, OpoConRefCtx& pOpoConRefCtx)
at Oracle.DataAccess.Client.OpsCon.Open(IntPtr& opsConCtx, IntPtr& opsErrCtx, OpoConValCtx* pOpoConValCtx, OpoConRefCtx& pOpoConRefCtx)
at Oracle.DataAccess.Client.ConnectionDispenser.CreateConnectionPool(OpoConCtx& opoConCtx)
at Oracle.DataAccess.Client.ConnectionDispenser.GetConnectionPool(OpoConCtx& opoConCtx, Boolean& bConObtained)
at Oracle.DataAccess.Client.ConnectionDispenser.Open(OpoConCtx opoConCtx, Int32 enlistAttrVal, Boolean& bGotEnlistedConnection)
at Oracle.DataAccess.Client.OracleConnectionOCP.Open(OracleConnection con)
at Oracle.DataAccess.Client.OracleConnection.Open()
at GenericOracleLogin.frmMain.btnLogin_Click(Object sender, EventArgs e)
in C:\VS\Workspaces\Visual Studio 2017\Projects\GenericOracleLogin\GenericOracleLogin\Form1.cs:line 56
Here is the relevant portion of the C# code:
OracleConnectionStringBuilder ConnString = new OracleConnectionStringBuilder();
ConnString.DataSource = txtDataSource.Text;
ConnString.UserID = txtUsername.Text;
ConnString.Password = txtPassword.Text;
String ConnectionString = ConnString.ToString();
Conn = new OracleConnection(ConnectionString);
Conn.Open();
The exception is thrown at Conn.Open()
I am using Oracle.DataAccess version 4.122.1.0; it is a 64-bit version running on a 64-bit app
Two things to note:
First, this is being done after Oracle was uninstalled and then reinstalled into a different directory. I can't find any references to "oracle.dataaccess" in any of the GAC directories. I also don't see any BindingRedirects in any readable machine.config files.
Second, when I use Oracle.ManagedDataAccess in place of Oracle.DataAccess, the code works.
I assume that the problem is, it is not using the specific version of Oracle.DataAccess.dll that I want it to use. How do I fix this?
I discovered that, while my main Oracle odp.net directory had Oracle.DataAccess.dll version 4.122.1.20161216, which is what I was using, my Oracle Data Toold odp.net directory had version 4.122.1.20170524. When I used the newer version, the app ran successfully.

HTTPS handshake not happening from IIS

I am having an application in which I am calling an external webservice.
There is a PFX file provided by the provider.
We are attaching the PFX file using X509Certificate2.
The application runs from Visual studio IIS express. But when pointed to IIS. It will start throwing 403 Forbidden error in the same Machine.
We have added the authentication Headers and Network credentials. But in IIS it will not work. The same exact copy works in Visual Studio.
This used to work before from IIS too. But, recently it stopped and it is not running again. Providers say they haven't changed anything.
NOTE: We have another REST service running in the same machine inside the same IIS without any errors. Both service is having similar codes and fiddler also is giving similar requests from Visual studio and IIS
Full error what I get
System.Net.WebException: The request failed with HTTP status 403: Forbidden. at
System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean, asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) at
Production.CompanyInfoWebService.getCompany(wsNumberRequest compInfoRequest) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\test\9b73ec26\5a34d414\App_WebReferences._jpe17z6.0.cs:line 477
at _Default.ButtonFetch_Click(Object sender, EventArgs e) in d:\TestWebsites\app_test\Default.aspx.cs:line 61

TNS:could not resolve the connect identifier specified I have done the research

I know, I know, you're going to tell me to check my paths and registry. I have, believe me.
My situation--we have two boxes running identical code with identical web.config files. Below are the specifications of both.
IIS 7.0, configured to reset the app pool at midnight
Oracle.ManagedDataAccess.dll, v 4.121.1.0
.NET 4.0 ASP.NET website
Relevant config section:
<oracle.manageddataaccess.client>
<version number="*">
<settings>
<setting name="TraceFileName" value="C:\MDM\TraceLog\"/>
<setting name="TraceLevel" value="7"/>
<setting name="SelfTuning" value="0"/>
<setting name="TNS_ADMIN" value="C:\MDM\tnsnames"/>
</settings>
</version>
</oracle.manageddataaccess.client>
Our problems began when we upgraded from unmanaged Oracle to the managed.
SYMPTOMS:
The main page of our site has an automatic refresh feature, such that every 2 minutes it reloads the page. Some of our users leave it open when they leave at the end of the day. At midnight, the app pool recycles. At about 12:02, since the release of the Oracle.ManagedDataAccess.dll we've been getting consistent could not resolve the connect identifier errors, which persist on any call out to the database until the app pool is recycled, at which point everything works swimmingly.
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-12154: TNS:could not resolve the connect identifier specified ---> OracleInternal.Network.NetworkException (0x00002F7A): ORA-12154: TNS:could not resolve the connect identifier specified
at OracleInternal.Network.AddressResolution..ctor(String TNSAlias, String instanceName)
at OracleInternal.Network.OracleCommunication.DoConnect(String tnsDescriptor)
at OracleInternal.ServiceObjects.OracleConnectionImpl.Connect(ConnectionString cs, Boolean bOpenEndUserSession, String instanceName)
at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, String instanceName)
at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
TNSPING is able to connect to the databases without issue. I left pages that hit both our boxes directly open last night, and only one of them displayed this issue. The tnsnames.ora file is located in the c:\mdm\tnsnames directory on both machines. The tnsnames.ora file is the most up to date file from our DB team.
The most infuriating part of this is that the connections work beautifully once the app pool is reset. No issues, no performance impact, and it didn't appear in our lower environments at all. I'm not able to provide a trace log because no matter what I do to the trace settings nothing shows up in the c:\mdm\tracelog directory.
Anyone have any ideas as to why this is happening?
EDITS:
There is no environment variable TNS_ADMIN; the registry variable is pointing to the same location as the config file.
All users have full permission on the tnsnames.ora file.
There are only two tnsnames.ora files, mine and the sample one included in the previous installation. There are three sqlnet.ora files, one in the same directory as the tnsnames.ora file, one in the %ORACLEHOME%\network\admin folder, and one in the %ORACLEHOME%\network\admin\sample folder.
If everythings works when you reset the AppPool, then it does not sound like it's related to TNSNAMES.ORA. It sounds more like the AppPool is stopping but not recycling.
Also, you mentioned that your main pages refresh and hit the server every two minutes, if they hit the server when the AppPool is recycling and fail, could this be causing the AppPool's Rapid-Fail Protection to shut it down? The AppPool comes with an option to Generate Recycle Event Log Entry, by default it's doesn't show much, you need to choose what you want to record. This log may hold more clues as to why the recycle event is not flying.
The log itself is a little hard to find, here's a link that may help you:
https://webmasters.stackexchange.com/questions/17630/which-event-log-file-does-iis-7-app-pool-log-to

Problems connecting to data folder using sage sdo18.(ForwardCallToInvokeMember)

I'm developing an automatic invoicing system using c#.net v4.0 and Sage's SDO. The Application works fine on my local machine both in a development environment and on iis 7. I am now trying to implement it on a live server and I am getting the following error:
SAGE EXCEPTION:Not connected to Data Source - Connect or Logon failed .
Error Code:sdoNotConnected
StackTrace: at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData) at SageDataObject180.IWorkSpace.CreateObject(String Name) at RestrictedPages_ViewReport.GenerateInvoice(Object sender, EventArgs e) in c:\inetpub\wwwroot\IE Support Manager Integration\RestrictedPages\ViewReport.aspx.cs:line 386
The iis7 process is running on a 32 bit process. The folder is hosted on a machine on the network but not on the machine that the web application is installed on. I can read and write to this folder from the web application so I doubt its a permissions problem.
I've been tearing my hair out with this problem for 2 days now so any help would be much appreciated!!
Can you post the actual code where the error is happening? I am guessing its permissions or a variable that needs changing.

SEHException while running azure project

I have just moved my azure project from sdk version 1.4 to 2.1.
After this move, I am having trouble starting the azure roles on my local machine. I get the following error:
[SEHException (0x80004005): External component has thrown an exception.]
RdGetApplicationConfigurationSetting(UInt16* , UInt16** ) +0
RoleEnvironmentGetConfigurationSettingValueW(UInt16* pszName, UInt16* pszDest, UInt32 cchDest, UInt32* pcchRequiredDestSize) +82
Microsoft.WindowsAzure.ServiceRuntime.Internal.InteropRoleManager.GetConfigurationSetting(String name, String& ret) +232
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName) +67
Surfmark.MVC.WebRole.FirstRequestInitialization.ApplicationStartUponFirstRequest(HttpContext context) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:232
Surfmark.MVC.WebRole.FirstRequestInitialization.Initialize(HttpContext context) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:223
Surfmark.MVC.WebRole.MvcApplication.Application_BeginRequest(Object sender, EventArgs e) in C:\Dev\code\www\Surfmark.CloudService\Surfmark.MVC.WebRole\Global.asax.cs:202
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
Please note that I am making a call to RoleEnvironment.GetConfigurationSettingValue() in the Application_BeginRequest() method in Global.asax. While using v1.4 of Azure SDK, I used to call CloudStorageAccount.SetConfigurationSettingPublisher() in the Application_Start() so that getting the configsetting doesnt error out. I notice that in v2.1 this method is no more there, so I am assuming I can access RoleEnvironment.GetConfigurationSettingValue() without error.
Please let me know what am I doing wrong here?
Thanks
Kapil
I think I figured this out. Actually I was upgrading my proj from 1.4 to 2.1 version od azure SDK. Now, I noticed that my proj was using full IIS to start the compute emulator on dev machine. I moved that to IIS-express (seems like thats the default for dev emulator in the new SDKs) and things seem to work well.
Thanks
Kapil

Categories

Resources