Unable to connect to Sybase, not getting error.
I have referenced Sybase.AdoNet4.AseClient.dll from C:\Sybase\DataAccess\ADONET\dll to my MVC 5 project, running in .NET 4.5
Web.Config Connections string
<add name="MyASEServer" connectionString="Data Source=127.0.0.20:12000;Initial Catalog=MyDB;User Id=USer1;Password=Password1;"
providerName="Sybase.Data.AseClient"/>
My code
string constr = ConfigurationManager.ConnectionStrings["MyASEServer"].ConnectionString;
IDbConnection aseDB = new AseConnection(constr );
var myCustomer = aseDB.Query<Customer>("select * fromdbo.customer");
When the debugger reaches aseDB.Query...., it never return and not receiving any error.
What am I missing.
In this case, Application Insights is on in visual studio and all the exceptions are captured in it. So the application screen is not showing the exception.
Related
I am trying to set up forms authentication on Reporting Server 2014. So far I was able to get rid of most of the errors but when trying to log in on reportserver/logon.aspx I get the following error:
An error occurred while attempting to get the ReportServer Url. Invalid namespace
I applied the following in web.config:
<add key="ReportServer" value="localhost"/>
<add key="ReportServerInstance" value="RS_SKOREPORTS"/>
The following is from my reportingservices.mof:
#pragma namespace ("\\\\.\\root\\Microsoft\\SqlServer\\ReportServer\\RS_SKOREPORTS\\V12")
I've tried several things like removing the RS_ prefix but the error remains.
EDIT:
Ok, I have come to the point where I know what's wrong by debugging everything, I just don't know how to fix it. My wmiNamespace string is adjusted for report server 2014 as follows: private const string wmiNamespace = #"\\{0}\root\Microsoft\SqlServer\ReportServer\RS_{1}\v12";
The weird thing is that when I debug the login process and put a watch on fullWmiNamespace the value it returns is:
"\\\\localhost\\root\\Microsoft\\SqlServer\\ReportServer\\RS_SKOREPORTS\\v10"
It looks like report server ignores the changes I made in AuthenticationUtilities.cs and just uses the unmodified version.
Fixed by hardcoding the wmiNamespace string. For some reason the FullWmiNamespace string didn't format the string properly..
I'm trying to run my .NET application, that resides in a network share from our domain, using a RDP Client.
When starting a "full" RDP session (that is, opening the whole desktop) and then running my application from the .exe file, everything works fine.
But when I set this same .exe as the Startup Application Path from the RDP Client , I get the following error:
(PS: I clipped the stack trace to the calls I found myself more important)
System.TypeInitializationException: The type initializer for 'NHibernate.Cfg.Environment' threw an exception. ---> System.ArgumentException: Incorrect Parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at System.Security.Policy.PEFileEvidenceFactory.GetLocationEvidence(SafePEFileHandle peFile, SecurityZone& zone, StringHandleOnStack retUrl)
(...)
at System.AppDomain.get_Evidence()
(...)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at NHibernate.Cfg.Environment.LoadGlobalPropertiesFromAppConfig() in p:\nhibernate-core\src\NHibernate\Cfg\Environment.cs:line 212
at NHibernate.Cfg.Environment..cctor() in p:\nhibernate-core\src\NHibernate\Cfg\Environment.cs:line 198
As I work with shadow-copied files, I set a new AppDomain when the application has just begun (the .exe entry point):
<STAThread()>
Public Sub Main()
Try
Dim currentDirectory As DirectoryInfo = New DirectoryInfo(Directory.GetCurrentDirectory)
Dim runtimeDirectory As DirectoryInfo = New FileInfo(Assembly.GetExecutingAssembly.Location).Directory
Dim appDomainStartupSetup As New AppDomainSetup
appDomainStartupSetup.ApplicationBase = currentDirectory.FullName
appDomainStartupSetup.ShadowCopyFiles = "true"
Dim appDomainStartup As AppDomain = AppDomain.CreateDomain("StartupAppDomain", Nothing, appDomainStartupSetup)
Dim entrypointLoader As LoadBaseFiles = appDomainStartup.CreateInstanceFromAndUnwrap(Assembly.GetExecutingAssembly.CodeBase, "MyClass.LoadBaseFiles")
entrypointLoader.RuntimeDir = runtimeDirectory.FullName ' Setup the 'entry-point' object
entrypointLoader.StartupEntryPoint() ' Starts the Application
Catch ex As Exception
' Error Handling Here
End Try
End Sub
Public Class LoadBaseFiles
Inherits MarshalByRefObject
' Startup stuff here...
End Class
More Info
Content of my ApplicationEntryPoint.exe.config file;
I had set the CAS Policy to Full Machine Trust, but I'm not sure this still applies to .NET 4.0;
The Remote Desktop (Terminal Services) Server runs Windows Server 2003;
EDIT:
If I copy all the assemblies to a local drive (C:) and run my application from there, it will work fine.
Any advices?
It looks like you're missing an argument or pointing to an unavailable resource.
a) Is the Working Directory set for the application?
b) Is the Working Directory available to the user on login?
Code and configuration:
I've enabled Diagnostics per the official tutorial at https://www.windowsazure.com/en-us/develop/net/common-tasks/diagnostics/. My diagnostic initializer is invoked from Global.asax (no WebRole.cs for this WCF ported to Azure WebRole) and its quite simple like:
public bool Initialize()
{
DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();
config.WindowsEventLog.DataSources.Add("Application!*");
config.WindowsEventLog.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0);
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
return true;
}
Cloud and Local strings same:
I'm using the SAME cloud based diagnostic connection string for local and cloud configurations.
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="MyApp.API.Azure1" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="2" osVersion="*" schemaVersion="2012-05.1.7">
<Role name="MyApp.API">
<Instances count="1" />
<ConfigurationSettings>
...
<Setting name="Microsoft.WindowsAzure.Plugins.Caching.ConfigStoreConnectionString" value="DefaultEndpointsProtocol=https;AccountName=myapi;AccountKey=MyVeryLongStringHereWhichIsActuallyAKeyForAPlaceInTheCloudWhereUnicornsDanceUnderDoubleRainbows" />
</ConfigurationSettings>
<Certificates>
<Certificate name="Microsoft.WindowsAzure.Plugins.RemoteAccess.PasswordEncryption" thumbprint="ThumbPrintStringsAreBiggerThanPinkiePrintString" thumbprintAlgorithm="sha1" />
</Certificates>
</Role>
</ServiceConfiguration>
Error:
When I run the above within Azure Emulator (local compute) I do not get the error (despite the cloud connection string for diagnostics). When I run the webrole on Azure (with same diagnostic sting and of course, code), I get the following error:
[UnauthorizedAccessException: Access to the path '05d5e525-e1bc-4a37-8bfb-010bb2941301-mswapd-lock' is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +12895415
System.Threading.MutexTryCodeHelper.MutexTryCode(Object userData) +229
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) +0
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew, MutexSecurity mutexSecurity) +629
System.Threading.Mutex..ctor(Boolean initiallyOwned, String name, Boolean& createdNew) +18
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.StartDiagnosticsMonitorProcess(DiagnosticMonitorStartupInfo info) +171
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.ReconfigureMonitoringProcess(ConfigRequest req) +209
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.UpdateState(DiagnosticMonitorStartupInfo startupInfo) +207
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.StartWithExplicitConfiguration(DiagnosticMonitorStartupInfo startupInfo, DiagnosticMonitorConfiguration initialConfiguration) +643
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(CloudStorageAccount storageAccount, DiagnosticMonitorConfiguration initialConfiguration) +47
Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start(String diagnosticsStorageAccountConfigurationSettingName, DiagnosticMonitorConfiguration initialConfiguration) +108
myApp.api.Diag.Diagnostics.Initialize() in c:\Work\MyApp.API\source\Diag\Diagnostics.cs:42
Global.Application_Start(Object sender, EventArgs e) in c:\Work\MyApp.API\source\Global.asax.cs:30
Attempts: None worked
Disabled all Azure monitoring and logging (from portal) for this storage account in case Azure's own monitoring/logging mechanisms were locking it down
Replaced UseDevelopmentStorage=true with real cloud connection string for diagnostics even for local configuration (local compute/Azure emulator).
Simplified diagnostic initializer to bare minimum (seen above). However, DiagnosticMonitor.Start(...) always fails.
Created another diagnostic connection string in .cscfg file (with reference in .csdef too) so that if the original Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString is also used by Azure infrastructure, I have another string for it. No help, same error.
I've burnt many hours trying to debug this but I always get this error on Azure.
Question:
Can someone help me get rid of this error? I can try a few ideas you may have. I'm disappointed by the MS tutorial but disappointment doesn't help.
Exactly the same symptoms here (but in an ASP.NET MVC application).
Basically you shouldn't be using the DiagnosticMonitor.Start() any more.
The below worked for me (Azure SDK 1.8, October 2012)
I simplified the init code from this article:
http://convective.wordpress.com/2010/12/01/configuration-changes-to-windows-azure-diagnostics-in-azure-sdk-v1-3/
private void ConfigureDiagnostics()
{
var wadConnectionString ="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
var cloudStorageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(wadConnectionString));
var roleInstanceDiagnosticManager =
cloudStorageAccount.CreateRoleInstanceDiagnosticManager(
RoleEnvironment.DeploymentId,
RoleEnvironment.CurrentRoleInstance.Role.Name,
RoleEnvironment.CurrentRoleInstance.Id);
var diagnosticMonitorConfiguration = roleInstanceDiagnosticManager.GetCurrentConfiguration();
diagnosticMonitorConfiguration.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1d);
diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1d);
diagnosticMonitorConfiguration.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
roleInstanceDiagnosticManager.SetCurrentConfiguration(diagnosticMonitorConfiguration);
}
I'm calling it from the Application_Start() in Global.asax.cs and it works fine now. Both locally and in the cloud.
You also need this in your web.config:
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
and this in your ServiceDefinition.csdef 's WebRole section:
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
These are added by the wizard by default, but still worth checking when migrating existing code to Azure.
A note to log4net users:
Specialized appenders are not really necessary, you can use the standard log4net.Appender.TraceAppender which comes with log4net - just configure it in your web.config and init log4net as usual it in your Application_Start() or prior to the 1st use.
Removing from trace listeners element this line fixed the problem for me.
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics" />
Know I'm thinking how to update already existing application configuration and not create one during the application start.
I have a console application written in C# 4.0. I am running a SQL stored procedure that sometimes takes too long and and a connection timeout exception gets thrown.
To handle it, I first set Timeout to 360 in the connection string in the web.config file but no luck.
Then i tried:
SQLCommand cmd = new SQLCommand();
cmd.CommandTimeout = 360;
but this is also not working.
Any help would be greatly appreciated. I tried to do same with the Entity Framework 4.0 but had the same issue. The timeout value i am providing is not being applied!
<add name="ConnectionString" connectionString="SERVER=db.mydomain.com;DATABASE=DatabaseName;UID=userID;PWD=Password;Connect Timeout=360;Packet Size=8192;Pooling=True;Min Pool Size=1;Max Pool Size=1000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
Exception:
Timeout expired: The timeout period elapsed prior to completion of the operation or the server is not responding.
Set the CommandTimeout = 0 in your code and remove it from the config file.
Setting the Timeout = 0 means, it will complete the job in case of long operation also.
Do you have context connection=true in the connection string in your Web.config file? According to MSDN:
CommandTimeout has no effect when the command is executed against a context connection
Following is the statement where I am getting the error :
var query = from c in objSearchedData.ToList() select c;
q = query;
Error:
_COMPlusExceptionCode = -532462766
{System.Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.}
I am using DBML and wcf service for the Silverlight 4. I have just migrated from Silverlight 3 the project. In old application its working fine. But after migration I am getting the error above.
Any ideas on how to fix the problem?
I was getting the same error when calling a method in my domain service from my Silverlight client.
I don't think this applies to you, but I added the HasSideEffect attribute to my method and it fixed it. Maybe this will help someone else.
[Query(HasSideEffects = true)]
public IQueryable<Entity1> GetEntitiesSafe(byte[] bytes)