Setting up .net site in IIS 8.5 (AWS) - asp.net

My .net project (Any CPU) is referring to Oracle.dataaccess x86 version . In my local GAC the odac version is x86. But in the web server where it was installed previously was having AMB64 version of odac in GAC . The site was working without any problem . Now I need to move the site to AWS .The windows instance in AWS has the below configuration.
OS version : Microsoft windows server 2012 R2 Standard .
IIS 8.5
The server is clean and does not have any software installed .
When I try to create a site , I ended up seeing **could not load file or assembly one of its dependencies **. Through forums I installed various libraries from Oracle but I don't understand what are the exact steps needed . I was just doing trial and error.
Please let me know the software or steps to follow which needs do be installed such that my .net site which is connecting to its Oracle database works .
Edit 1 :
Hi ,
I performed the following steps .
As suggested by you I added Oracle.managedDataaccess dll(x86) . It worked well in my local.
Deployed the same code in the server.
I installed the oracle_12.1.0.1.0
In C:/oracle_12.1.0.1.0/odp.net/managed/x86 I ran the bat file for configuring the managed odac in the server. I was able to see the changes in the machine.config file .
5.Now when I ran the site I got the below error .
System.Reflection.TargetInvocationException: Exception has been thrown
by the target of an invocation. --->
System.TypeInitializationException: The type initializer for
'Oracle.DataAccess.Client.OracleClientFactory' threw an exception.
---> System.DllNotFoundException: Unable to load DLL 'OraOps12.dll': The specified module could not be found. (Exception from HRESULT:
0x8007007E) at
Oracle.DataAccess.Client.OpsInit.CheckVersionCompatibility(String
version) at Oracle.DataAccess.Client.OracleInit.Initialize() at
Oracle.DataAccess.Client.OracleClientFactory..cctor() --- End of
inner exception stack trace --- --- End of inner exception stack
trace --- at System.RuntimeFieldHandle.GetValue(RtFieldInfo field,
Object instance, RuntimeType fieldType, RuntimeType declaringType,
Boolean& domainInitialized) at
System.Reflection.RtFieldInfo.UnsafeGetValue(Object obj) at
System.Reflection.RtFieldInfo.GetValue(Object obj) at
System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
In order to fix this I added OraOps12 dll from c:/oracle_12.1.0.1.0/bin to the wwwroot/site/bin folder. Then I got the below error .
System.ArgumentException: Unable to find the requested .Net Framework
Data Provider. It may not be installed. at
System.Data.Common.DbProviderFactories.GetFactory(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.CreateConnectionFromProviderName(String
providerInvariantName) at
System.Data.Entity.Internal.LazyInternalConnection.InitializeFromConnectionStringSetting(ConnectionStringSettings
appConfigConnection) at
System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String
name, AppConfig config) at
System.Data.Entity.Internal.LazyInternalConnection.Initialize() at
System.Data.Entity.Internal.LazyInternalConnection.get_Connection()
at Sample.Data.AbstractEFUnitOfWork2.SetClientId(String clientId)
at Sample.Web.Controllers.ApiControllerBase1..ctor(IUow uow,
IConnectionManager cm, IEnumerable`1 allowedAppUserbases, String
connectionName, Boolean allowSaves)
Checking to resolve this .
Appreciate your suggestions.

Related

Exception while saving to Raven

I'm getting an exception while trying to save an entity to Raven in one of our environments.
Here are details:
Application Target Framework: .NET Core 2.1
RavenDB.Client Version: 4.1.2
.Net Core Runtime and Hosting Bundle installed on the server:
2.0.5
2.1.3
2.1.6
2.2.0
(We have multiple versions installed since it is a shared environment with multiple applications hosted)
Exception:
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
at Sparrow.Json.UnmanagedWriteBuffer.Write(Byte* buffer, Int32 count)
at Sparrow.Json.BlittableWriter`1.WriteValue(Byte* buffer, Int32 size, FastList`1 escapePositions, BlittableJsonToken& token, UsageMode mode, Nullable`1 initialCompressedSize) in C:\Builds\RavenDB-Stable-4.1\src\Sparrow\Json\BlittableWriter.cs:line 555
at Sparrow.Json.BlittableJsonDocumentBuilder.ReadInternal[TWriteStrategy]() in C:\Builds\RavenDB-Stable-4.1\src\Sparrow\Json\BlittableJsonDocumentBuilder.cs:line 320
at Sparrow.Json.JsonOperationContext.ReadObjectInternal(Object builder, String documentId, UsageMode mode, IBlittableDocumentModifier modifier) in C:\Builds\RavenDB-Stable-4.1\src\Sparrow\Json\JsonOperationContext.cs:line 619
at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.StoreEntityInUnitOfWork(String id, Object entity, String changeVector, DynamicJsonValue metadata, ConcurrencyCheckMode forceConcurrencyCheck) in C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\Session\InMemoryDocumentSessionOperations.cs:line 741
at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.StoreInternal(Object entity, String changeVector, String id, ConcurrencyCheckMode forceConcurrencyCheck) in C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\Session\InMemoryDocumentSessionOperations.cs:line 673
at Raven.Client.Documents.Session.InMemoryDocumentSessionOperations.StoreAsyncInternal(Object entity, String changeVector, String id, ConcurrencyCheckMode forceConcurrencyCheck, CancellationToken token) in C:\Builds\RavenDB-Stable-4.1\src\Raven.Client\Documents\Session\InMemoryDocumentSessionOperations.cs:line 703
<Project Specific StackTrace>
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at System.Threading.Tasks.ValueTask`1.get_Result()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
Interestingly the application works perfectly fine in one of the very similar machine with identical set up and same set of framework installed. I'm not sure what is causing this Raven to fail. Any pointers is highly appreciated.
Looks like System.Runtime.CompilerServices.Unsafe is not installed correctly.
Try:
1. Installing and using the latest RavenDB client package -OR-
2. Try to manually install from
https://www.nuget.org/packages/System.Runtime.CompilerServices.Unsafe/
Install-Package System.Runtime.CompilerServices.Unsafe -Version 4.5.2
After fiddling around for more than day. I was able to reproduce the issue on my local machine with following setup:
No DOTNET Core SDK installed
Installed .NET Core Hosting and Runtime for .NET Core 2.1.3 and .NET Core 2.2.0
If I ALSO had .NET Core 2.1.6 Hosting and Runtime installed on my machine (with or without 2.1.3) the issue disappeared.
That made me to believe that .NET Core 2.1.6 installation on affected environment was somehow corrupt. So I uninstalled and reinstalled .NET Core 2.1.6 Hosting and Runtime, and this magically fixed issue.
However, this has now made our IT a bit nervous and jittery as they now feel Hosting and Runtimes cannot be trusted anymore. You literally are shooting in dark in such issues are encountered.

Visual Basic 2015 project for VB.NET to work in XP

Apologies for my lack of knowledge as I do not have much experience.
I have created a VB.NET application using visual basic 2015 however, when I tried to run the application on XP Professional Version 2002 SP3 I get the follow error message.
I have for the life of me do not know how to fix this. The .net framework which the application was created in was 4.5.2.
The application works perfectly on Windows 7 and Windows 10.
However, issues are only on XP
PLATFORM VERSION INFO
Windows : 5.1.2600.196608 (Win32NT)
Common Language Runtime : 4.0.30319.269
System.Deployment.dll : 4.0.30319.1 (RTMRel.030319-0100)
clr.dll : 4.0.30319.269 (RTMGDR.030319-2600)
dfdll.dll : 4.0.30319.1 (RTMRel.030319-0100)
dfshim.dll : 4.0.31106.0 (Main.031106-0000)
SOURCES
Deployment url : file:///C:/Documents%20and%20Settings/rwuser/Desktop/Disk%20Cleanup%20Toolkit/drive_cleanup.application
ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Documents and Settings\rwuser\Desktop\Disk Cleanup Toolkit\drive_cleanup.application resulted in exception. Following failure messages were detected:
+ Exception reading manifest from file:///C:/Documents%20and%20Settings/rwuser/Desktop/Disk%20Cleanup%20Toolkit/drive_cleanup.application: the manifest may not be valid or the file could not be opened.
+ Manifest XML signature is not valid.
+ SignatureDescription could not be created for the signature algorithm supplied.
COMPONENT STORE TRANSACTION FAILURE SUMMARY
No transaction error was detected.
WARNINGS
There were no warnings during this operation.
OPERATION PROGRESS STATUS
* [28/07/2016 09:56:20] : Activation of C:\Documents and Settings\rwuser\Desktop\Disk Cleanup Toolkit\drive_cleanup.application has started.
ERROR DETAILS
Following errors were detected during this operation.
* [28/07/2016 09:56:21] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
- Exception reading manifest from file:///C:/Documents%20and%20Settings/rwuser/Desktop/Disk%20Cleanup%20Toolkit/drive_cleanup.application: the manifest may not be valid or the file could not be opened.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestDirectBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options, ServerInformation& serverInformation)
at System.Deployment.Application.DownloadManager.DownloadDeploymentManifestBypass(SubscriptionStore subStore, Uri& sourceUri, TempFile& tempFile, SubscriptionState& subState, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
--- Inner Exception ---
System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Manifest XML signature is not valid.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
--- Inner Exception ---
System.Security.Cryptography.CryptographicException
- SignatureDescription could not be created for the signature algorithm supplied.
- Source: System.Security
- Stack trace:
at System.Security.Cryptography.Xml.SignedXml.CheckSignedInfo(AsymmetricAlgorithm key)
at System.Security.Cryptography.Xml.SignedXml.CheckSignature(AsymmetricAlgorithm key)
at System.Security.Cryptography.Xml.SignedXml.CheckSignatureReturningKey(AsymmetricAlgorithm& signingKey)
at System.Deployment.Internal.CodeSigning.SignedCmiManifest.Verify(CmiManifestVerifyFlags verifyFlags)
at System.Deployment.Application.Manifest.AssemblyManifest.ValidateSignature(Stream s)
COMPONENT STORE TRANSACTION DETAILS
No transaction information is available.
XP only supports the .NET Framework up to version 4.0. If you want to run it on XP you'll need to change the target framework to 4 and re-compile the project.
https://blogs.msdn.microsoft.com/dotnet/p/dotnet45xp/

ASP.NET Web API error after upgrading to Visual Studio 2012 RC: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation

After upgrading to Visual Studio 2012 I can no longer access any of my ApiControllers, the following error is thrown:
Server Error in '/' Application.
Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.
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.MissingMethodException: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.
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:
[MissingMethodException: Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1<System.String>)'.]
System.Web.Http.WebHost.HttpControllerHandler.AddHeaderToHttpRequestMessage(HttpRequestMessage httpRequestMessage, String headerName, String[] headerValues) +0
System.Web.Http.WebHost.HttpControllerHandler.ConvertRequest(HttpContextBase httpContextBase) +248
System.Web.Http.WebHost.HttpControllerHandler.BeginProcessRequest(HttpContextBase httpContextBase, AsyncCallback callback, Object state) +79
System.Web.Http.WebHost.HttpControllerHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +268
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626
Anyone knows how to fix this?
You have a reference to an old version of System.Net.Http in your project. To fix this, go under "References" in your project, delete System.Net.Http, and add the version that comes with .NET 4.5 instead. That should do it.
Henrik
Solution to this and other RC-related issues right here.
step 1
Remove the below references from your project:
System.Net.Http, System.Web.Http, System.Web.Http.WebHost , System.Web.Http.Common & System.Net.Http.Formatting
step 2
Add the above refefrences (except the System.Web.Http.Common & System.Net.Http.Formatting) from Below location
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.AspNet.WebApi.Core.4.0.20505.0\lib\net40
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.AspNet.WebApi.WebHost.4.0.20505.0\lib\net40
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Microsoft.Net.Http.2.0.20505.0\lib\net40
and add one more new dll Newtonsoft.Json.dll from
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 4\Packages\Newtonsoft.Json.4.5.1\lib\net40
This fixed it for me.
http://forums.asp.net/t/1809919.aspx/1
Method not found: 'Void System.Net.Http.Headers.HttpHeaders.AddWithoutValidation(System.String, System.Collections.Generic.IEnumerable`1)'.
I resolved it with the following steps. Not sure if all of them are required, but it worked.
In NuGet Package Manager, uninstalled the Web.API Beta package.
Added references to System.Net.Http, System.Web.Http, & System.Web.Http.WebHost (these were removed by the previous step).
Installed Json.Net via NuGet.
As an addition, if your project is targeting the 4.0 version of the framework, you must include the new Microsoft ASP.Net Web API set of packages from NUGET, to get a green light for your build. Json.Net is a dependency for these new packages, so you need not install it separate.

Trying to integrate PayPal checkout express, using classes\dll provided by PayPal, getting: Could not load file or assembly 'log4net

Using .Net framework 4. I am assuming this log4net version that the PayPal library is dependent on
requires an older version or I don't have the file at all? Do I need to get this file somewhere or
is there another work around ?
Update, after installing latest version of log4net I now get the same error except the file is found
this time and says**:
The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
com.paypal.sdk.profiles.BaseAPIProfile..cctor() +0
Line 23: {
Line 24: NVPCallerServices caller = new NVPCallerServices();
Line 25: **IAPIProfile profile = ProfileFactory.createSignatureAPIProfile();**
code.
Stack Trace:
[FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.]
com.paypal.sdk.profiles.BaseAPIProfile..cctor() +0
[TypeInitializationException: The type initializer for 'com.paypal.sdk.profiles.BaseAPIProfile' threw an exception.]
com.paypal.sdk.profiles.BaseAPIProfile..ctor() +0
com.paypal.sdk.profiles.SignatureAPIProfile..ctor() +29
com.paypal.sdk.profiles.ProfileFactory.createSignatureAPIProfile() +39
GenerateCodeNVP.ECSetExpressCheckout.ECSetExpressCheckoutCode(String returnURL, String cancelURL, String amount, String paymentType, String currencyCode) in C:\Users\Admin\Documents\Visual Studio 2010\Projects\MyProject\DotNetNVPGenerate\ECSetExpressCheckout.cs:25
NeoCart.WebUI.Controllers.CheckoutController.Payment() in C:\Users\Admin\Documents\Visual Studio 2010\Projects\MyProject\NeoCart.WebUI\Controllers\CheckoutController.cs:179
lambda_method(Closure , ControllerBase , Object[] ) +96
Log4net is a separate open-source project.
You can get it from within Visual Studio using NuGet, or you can download it from Apache's website.
This question is a little old, but wanted to let you know, I was having the same issue, and found the proper library for this issue. You'll want to go to the Beta 8 archive for the sourceforge project here: http://sourceforge.net/projects/log4net/files/log4net/1.2.0%20Beta8/
Download this repository, and look in log4net-1.2.0-beta8\log4net-1.2.0-beta8\bin\net\1.0\release, the log4net.dll has the version 1.2.0.30714
Even if you don't use this, someone else might run into this question, and hopefully this response will help fix the issue for anyone else.

ASP.NET has no access to IIS metabase

How to solve this problem?
I am using asp.net 2.0, vs2005 and IIS 5.1.
Using Windows XP SP3.
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) +3591442
System.Web.Configuration.MetabaseServerConfig.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath vpath) +9
System.Web.Hosting.HostingEnvironment.MapPathActual(VirtualPath virtualPath, Boolean permitNull) +169
System.Web.CachedPathData.GetConfigPathData(String configPath) +389
System.Web.CachedPathData.GetConfigPathData(String configPath) +243
System.Web.CachedPathData.GetApplicationPathData() +68
System.Web.CachedPathData.GetVirtualPathData(VirtualPath virtualPath, Boolean permitPathsOutsideApp) +3536567
System.Web.Configuration.RuntimeConfig.GetLKGRuntimeConfig(VirtualPath path) +189
The rights of the ASPNET user have not been set correctly.
What version of ASP.NET are you running?
try
Start -> Run
Type cmd <HIT RETURN>
Type c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -i <HIT RETURN>
or as suggested
aspnet_regiis.exe -ga ASPNET
Running asnet_regiis with the -i option might not be enough, as the reason might be the lack of proper IIS Metabase access rights for ASPNET account.
I would suggest running it with the -ga option:
aspnet_regiis.exe -ga ASPNET
As a general comment, this issue will occur if one installs Visual Studio and/or the .Net Framework before installing IIS.
try running aspnet_regiis -i from the dotnet directory. It has a way of fixing things.
Simply run the following from the cmd
%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i

Resources