.NET 4.0 migration error: Culture is not supported - .net-4.0

We have migrated our web applications and services from .NET 2.0 to .NET 4.0. Since then I am getting the below exception on one of the screens.
This error is at this line of code:
obj.name = sqldatareader["name"].ToString()
There are similar sqldatareaders used in other parts of code which works fine.
Additional information:
Version information: Microsoft .NET Framework version: 4.0.30319, IIS 7.5, win 2012 r2.
Regional settings are set correctly on the web servers (to Japanese)
Any pointers on this issue would be helpful.
Error:
General Information
Additional Info:
MessageDetails: Exception Details: System.Exception --->
System.Exception ---> System.Globalization.CultureNotFoundException:
Culture is not supported.
Parameter name: culture
66577 (0x10411) is an invalid culture identifier.
at System.Globalization.CultureInfo.GetCultureInfo(Int32 culture)
at System.Globalization.CompareInfo.GetCompareInfo(Int32 culture)
at System.Data.ProviderBase.FieldNameLookup.LinearIndexOf(String
fieldName, CompareOptions compareOptions)
at System.Data.ProviderBase.FieldNameLookup.IndexOf(String
fieldName)
at System.Data.ProviderBase.FieldNameLookup.GetOrdinal(String
fieldName)
at System.Data.SqlClient.SqlDataReader.GetOrdinal(String name)
at System.Data.SqlClient.SqlDataReader.get_Item(String name)

Related

WCF Async method works on Windows 7 host, but throws signature Exception on XP machine

My code (target framework 4.0, x86 architecture) works on several Windows 7 machines (both client and server) but throws an Invalid Async Begin method signature Exception on Windows Xp (same .NET framework version) specifying that a method requires IAsyncResult as result type and a callback method.
Actually, my methods use successfully Task<GenericType> as return type and I'm wondering why it fails only on XP hosts.
Example of service contract:
[OperationContract(AsyncPattern = true)]
Task<GetServerConfigurationResult> GetServerConfigurationAsync(string clientID);
Note: I hope there's a smarter solution than refactoring.

Exception Using GDAL in WCF Rest Service

I am developing a WCF REST service (.net 4) that uses the GDAL libraries. It works great on my development machine but throws an exception on the server (Windows Server 2008 R2). The code fails at
OSGeo.GDAL.Gdal.AllRegister();
Here's the exception:
20130214081020 Exception Message: The type initializer for 'OSGeo.GDAL.GdalPINVOKE' threw an exception.
20130214081020 Exception Stack Trace: at OSGeo.GDAL.GdalPINVOKE.AllRegister()
at OSGeo.GDAL.Gdal.AllRegister()
at RasterValues.GetDemElevation(String latitude, String longitude)
20130214081020 Inner exception Message: The type initializer for 'SWIGExceptionHelper' threw an exception.
20130214081020 Inner exception stack trace: at OSGeo.GDAL.GdalPINVOKE.SWIGExceptionHelper..ctor()
at OSGeo.GDAL.GdalPINVOKE..cctor()
I have copied the GDAL files to the server and have added the path to those in the PATH environment variable.
Any thoughts on what I'm missing? Thanks!
It turns out that I needed to add the *_wrap.dll files to the bin folder of my service.

Unable to cast COM object of type 'FAXCOMEXLib.FaxServerClass'

Hi All,
I have created a Dotnet Application using Dotnet 4.0 Programming language as VB.Net4.0. I have a Windows Service which sends out Fax Document using FaxComexLib Com Component, i have its Inetrop.FaxComexLib.dll, it works great in Windows 7 and Window 2008 Server, i can send out Faxes without any problems.
I have a Legacy Client which Windows XP home with ServicePack3 , i installed my WindowsService there and the Service Works fine other than communicationg with the FaxComexLib Com Component. I tried Several Possible solutions, i copied the the Registry entry({571CED0F-5609-4F40-9176-547E3A72CA7C}) from windows 7 to windows XP, Still no luck
Here is my exception:
System.InvalidCastException: Unable to cast COM object of type 'FAXCOMEXLib.FaxServerClass'
to interface type 'FAXCOMEXLib.IFaxServer2'.
This operation failed because the QueryInterface call on the COM component for the interface with IID '{571CED0F-5609-4F40-9176-547E3A72CA7C}' failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, Boolean& pfNeedsRelease)
at FAXCOMEXLib.FaxServerClass.Connect(String bstrServerName)
Any Solutions for this would be greatly appeciated.
Thanks In advance
Suresh
It's been a looong time since I used FaxComExLib, but if memory serves, you need to install the Fax printer or something for XP, it is not installed by default.

Cannot seem to fix "The protocol 'net.msmq' does not have an implementation of HostedTransportConfiguration type registered."

I am running on Windows 7/IIS 7.5, and have a web service set up to use net.msmq, but when I attempt to access the service using HTTP, I get the following error:
The protocol 'net.msmq' does not have an implementation of HostedTransportConfiguration type registered.
[InvalidOperationException: The protocol 'net.msmq' does not have an implementation of HostedTransportConfiguration type registered.]
System.ServiceModel.AsyncResult.End(IAsyncResult result) +15778592
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15698937
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
I have set both http and net.msmq bindings on the site under which it resides, and have enabled both protocols ("http,net.msmq") on both the site and application.
I've looked at the article Debugging a Missing HostedTransportConfiguration Type and have run all the commands there, but none seemed to help; running sc query netmsmqactivator shows:
SERVICE_NAME: netmsmqactivator
TYPE : 20 WIN32_SHARE_PROCESS
STATE : 4 RUNNING
(STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
The App Pool that the application is running under right now is targeting .NET Framework v2.0, but if I change the app pool to target .NET Framework v4.0 (and make appropriate changes to the service's web.config to remove duplicate configSection definitions), I am able to see the WSDL just fine.
As far as I know, the web service is not meant to be run targeting .NET Framework v4.0; it is actually working for a colleague of mine (also running Windows 7), but comparing setups isn't viable at this time for numerous reasons.
Another note, may or may not be related:
After attempting to access the service via HTTP and getting the above error, refreshing the service results in:
An item with the same key has already been added.
[ArgumentException: An item with the same key has already been added.]
System.ServiceModel.AsyncResult.End(IAsyncResult result) +15778592
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +15698937
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +265
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
This requires an app pool recycle to clear.
I don't have experience working with net.msmq, so I do not know what pertinent information I may have left out; please let me know what I've missed.
Figured it out: Not sure what was messed up, but turns out that uninstalling then reinstalling WCF Non-HTTP Activation fixed it.
If you are hosting an MSMQ/WCF service in IIS, you have to tell IIS to allow net.msmq protocol. It's in the advanced settings for the application or site in which you are hosting the service.

WCF service hosted in IIS throws 'Failed to access IIS metabase' error

Deployed a WCF service in IIS 6.0 gave NETWORK_sERVICE user read/write privileges.
When tries to brows to .SVC file i get below error
Failed to access IIS metabase.
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.Web.Hosting.HostingEnvironmentException: Failed to access IIS metabase.
The process account used to run ASP.NET must have read access to the IIS metabase (e.g. IIS://servername/W3SVC). For information on modifying metabase permissions, please see http://support.microsoft.com/?kbid=267904.
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:
[HostingEnvironmentException: Failed to access IIS metabase.]
System.Web.Configuration.MetabaseServerConfig.MapPathCaching(String siteID, VirtualPath path) +637
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +174
System.Web.Hosting.HostingEnvironment.MapPathInternal(VirtualPath virtualPath, Boolean permitNull) +51
System.Web.CachedPathData.GetConfigPathData(String configPath) +341
System.Web.CachedPathData.GetConfigPathData(String configPath) +234
System.Web.CachedPathData.GetApplicationPathData() +38
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +8806383
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +117
Any thoughts?
Was told that we get 'Failed to access IIS metabase' error if we install IIS after intalling .NET Framework, and remedy is to re-install ASP.NET.
To resolve this error I have followed below steps
1. Stopped IIS
2. Ran below command in command prompt to re-install aspnet.
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
Result:
Start installing ASP.NET (2.0.50727).
..................................................................
Finished installing ASP.NET (2.0.50727).
3. Re-started IIS and WCF service is responding without any issues.