Mongodb worker role throws System.IO.FileNotFoundException - mongodb

I have an Azure cloud project which makes use of mongodb worker roles. When running in the local emulator everything works fine, however when I deploy to an Azure staging area, the mongodb worker roles are stuck cycling and show a System.IO.FileNotFoundException. I connected to one of the virtual machines remotely and looked at the event viewer and found the following error:
An unhandled exception occurred. Type: System.IO.FileNotFoundException
Process ID: 1936 Process Name: WaWorkerHost Thread ID: 4 AppDomain
Unhandled Exception for role MongoDB.WindowsAzure.MongoDBRole_IN_0
Exception: Could not load file or assembly 'mswacdmi, Version=1.7.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The system cannot find the file specified. at
Microsoft.WindowsAzure.StorageClient.CloudDrive..ctor(Uri uri,
StorageCredentials credentials) at
Microsoft.WindowsAzure.StorageClient.CloudStorageAccountCloudDriveExtensions.CreateCloudDrive(CloudStorageAccount
storageAccount, String pageBlobUri) at
MongoDB.WindowsAzure.MongoDBRole.Utilities.GetMountedPathFromBlob(String
localCachePath, String cloudDir, String containerName, String
blobName, Int32 driveSize, CloudDrive& mongoDrive) in
c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\Utilities.cs:line
78 at
MongoDB.WindowsAzure.MongoDBRole.MongoDBRole.GetMongoDataDirectory()
in c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\MongoDBRole.cs:line 255 at MongoDB.WindowsAzure.MongoDBRole.MongoDBRole.StartMongoD()
in c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\MongoDBRole.cs:line 201 at MongoDB.WindowsAzure.MongoDBRole.MongoDBRole.OnStart() in
c:\Users\Matt\Software\AzurePrototype1\mongo-azure-master\src\MongoDB.WindowsAzure.MongoDBRole\MongoDBRole.cs:line 91 at
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType
roleTypeEnum) at
Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__0()
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
ignoreSyncCtx) at
System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
Why does this work locally and not on Azure? I don't understand much about assemblies and such, but I am learning as I go along. One of the things suggested online is to check the properties of references assemblies and set 'Copy Local' to true, I have tried this but still the same error.

In your worker role project, Make sure you have a .NET reference to mswacdmi.dll with the Properties set Copy Local=true. When you publish - RDP to your Azure role instance to verify that your deployed role has the assembly in the /bin directory.
Also make sure you are targeting x64 - I found mswacdmi.dll at this path (Azure SDK 1.8):
C:\Program Files\Microsoft SDKs\Windows Azure.NET SDK\2012-10\bin\runtimes\storage\cloud\x64

Related

Suddenly getting ##[error]System.ArgumentNullException: Value cannot be null. (Parameter 'input')

Problem appeared just today - previously it was working fine. Suddenly getting the error:
##[error]System.ArgumentNullException: Value cannot be null. (Parameter ‘input’)
at System.Text.RegularExpressions.Regex.Replace(String input, String replacement)
at Microsoft.VisualStudio.Services.Agent.Util.StringUtil.DeactivateVsoCommands(String input)
at Microsoft.VisualStudio.Services.Agent.Worker.WorkerUtilities.DeactivateVsoCommandsFromJobMessageVariables(AgentJobRequestMessage message)
at Microsoft.VisualStudio.Services.Agent.Worker.Worker.RunAsync(String pipeIn, String pipeOut)
at Microsoft.VisualStudio.Services.Agent.Worker.Program.MainAsync(IHostContext context, String[] args)
Error reported in diagnostic logs. Please examine the log for more details.
- /home/vsts/agents/2.213.1/_diag/Worker_20221110-110312-utc.log
Pool: Azure Pipelines
Image: ubuntu-latest
Queued: Today at 13:00 [manage parallel jobs]
The agent request is already running or has already completed.
The stage seems waiting for the agent and after that fails with above message.
After cancelling the pipeline and restarting the stage - the same error. What is the problem? What would be temporary workaround?
Our pipelines are defined with yaml.
I have no access to the log indicated above so can not provide more details from there.
Regards,
Roman.
UPDATE 14/11/2022:
After applying patch 2.213.2 to MS hosted agents Microsoft has resolved the issue
===============================================
Update 11/14
According to this latest release for the agent, the error has been fixed in the version of 2.213.2.
You could try to update again and test to see if the issue persists.
If the issue is still observed, you could share the latest status with us.
This issue started yesterday also for us. It's indeed related to the fact the pipeline is using Subversion source. We mitigated the issue by switching to our own private/custom agent pool. Moved away from the public azure devops agents.
Update 1:
The mitigation worked for a few hours but all pipelines are now failing with:
##[error]System.ArgumentOutOfRangeException: The startIndex argument must be greater than or equal to zero. (Parameter 'startIndex')
at System.Collections.Concurrent.ConcurrentStack`1.ValidatePushPopRangeInput(T[] items, Int32 startIndex, Int32 count)
at System.Collections.Concurrent.ConcurrentStack`1.PushRange(T[] items, Int32 startIndex, Int32 count)
at System.Collections.Concurrent.ConcurrentStack`1.PushRange(T[] items)
at Agent.Plugins.Repository.SvnCliManager.<>c__DisplayClass3_0.<GetSvnWorkingCopyPaths>b__0(String fld)
at System.Linq.Parallel.ForAllOperator`1.ForAllEnumerator`1.MoveNext(TInput& currentElement, Int32& currentKey)
at System.Linq.Parallel.ForAllSpoolingTask`2.SpoolingWork()
at System.Linq.Parallel.SpoolingTaskBase.Work()
at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
at System.Linq.Parallel.QueryTask.<>c.<.cctor>b__10_0(Object o)
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.<>c.<.cctor>b__274_0(Object obj)
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
Had the same issue that started yesterday 11/10/2022 with subversion and Azure Hosted Build Agents. Had to build an on premise hosted agent and point build pipeline to use that instead of the azure hosted one.

Apache Ignite crash on startup

I'm using Apache Ignite entity framework Nuget as a second level cache in an ApsNetCore 2.0 web application under IIS(as reverse proxy).
On my development machine (VS2017 Windows 8.1) everything works well. Wen i deploy to WindowsServer 2012 the Ignite crash at startup with :
An error occurred while starting the application.
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
TargetInvocationException: Exception has been thrown by the target of an invocation.
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, bool publicOnly, bool noCheck, ref bool canBeCached, ref RuntimeMethodHandleInternal ctor, ref bool bNeedSecurityCheck)
IgniteException: Failed to load jvm.dll (Please specify IgniteConfiguration.JvmDllPath or JAVA_HOME.)
Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(string configJvmDllPath, ILogger log)
Apache.Ignite.Core.Ignition.Start(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration.GetOrStartIgnite(IgniteConfiguration cfg)
Apache.Ignite.EntityFramework.IgniteDbConfiguration..ctor()
I checked and re-chewed, installed the JDK , correct system variables....everything. The error don't goes away. What is interesting is the application run ok as console. When it runs under IIS(reverse proxy) it crashes at startup with the above error.
Any suggestions ?
Thank you
I managed to start the website. How ? Only with JDK 11 and explicit path to jvm.dll on app.config file:
If is not explicit in config then crashes.
The JAVA_HOME from system variable is correct set. Also the Path variable is
%JAVA_HOME%;%JAVA_HOME%\bin;%JAVA_HOME%\bin\server;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\dotnet;C:\Program Files (x86)\dotnet;C:\ProgramData\chocolatey\bin;C:\Program Files\Memurai;C:\Program Files\Java\jdk-15.0.1\bin\
Maybe is a conflict with C:\Program Files\Java\jdk-15.0.1\bin\ ? It carsh with jvm 15. But it works with jvm 11
Looks like the IIS worker process is running in 32-bit mode, so Ignite looks for a 32-bit JDK, which is not present.
And the console app runs in 64-bit mode, using 64-bit JDK, so it works.
Please check the app pool settings in IIS Manager -> Application Pools -> select the app pool you want and -> Advanced Settings.
Additionally, you can enable detailed logging to a file (since you can't see console logs in IIS) - Ignite logs all attempts to resolve the JDK path. For example, with Apache.Ignite.NLog package:
var nlogConfig = new LoggingConfiguration();
var fileTarget = new FileTarget
{
FileName = "/home/pavel/w/ignite_nlog.log"
};
nlogConfig.AddTarget("logfile", fileTarget);
nlogConfig.LoggingRules.Add(new LoggingRule("*", LogLevel.Trace, fileTarget));
LogManager.Configuration = nlogConfig;
var igniteConfig = new IgniteConfiguration
{
Logger = new IgniteNLogLogger()
};
Ignition.Start(igniteConfig);
I've checked the suggested points by Pavel Tupitsyn:
App pool aplication is 64bits (emable 32bits=false)
I've installed apache.Ignite.NLog
I'tested it on my machine and it logs well all java resolves.
I've deployed to windows server 2012 and under IIS i'm getting 'Process Failure'.
The log file looks like:
2020-12-07 19:39:38.3304|DEBUG||Starting Ignite.NET 2.9.0.50002
2020-12-07 19:39:38.3834|WARN||GC server mode is not enabled, this could lead to less than optimal performance on multi-core machines (to enable see http://msdn.microsoft.com/en-us/library/ms229357(v=vs.110).aspx).
2020-12-07 19:39:46.2534|DEBUG||Starting Ignite.NET 2.9.0.50002
so...just a warning (present on my machine too).
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info:
Apache.Ignite.Core.Common.IgniteException
at Apache.Ignite.Core.Impl.Unmanaged.Jni.JvmDll.Load(System.String, Apache.Ignite.Core.Log.ILogger)
at Apache.Ignite.Core.Ignition.Start(Apache.Ignite.Core.IgniteConfiguration)
at Nop.Web.Program.Main(System.String[])
well...adding apache.ingite.nlog throws PROCESS FAILURE
Hosting is virtual machine with Windows Server 2012 64bits
Any other ideas please....

CSPack RemotingException while packaging Cloud service project with MSBuild

I have a powershell script that is packaging our builds and deploys them to Azure Cloud Services. This script was running without any problem with SDK 2.3, but when we upgraded to SDK 2.5 we started receiving the following error while building the project:
CorePublish:
CorePublish: PackageWebRole = True
Publishing starting...
RolePlugins is
Importedmodules is
Publishing to 'bin\Release\app.publish\'
Creating directory "bin\Release\app.publish\".
TargetServiceDefinition is bin\Release\ServiceDefinition.csdef
TargetServiceConfiguration is bin\Release\ServiceConfiguration.cscfg
Roles is E:\Preview\temp\Azure\obj\Release\App\
error MSB4018: The "CSPack" task failed unexpectedly.
System.Runtime.Remoting.RemotingException: Object '/54628d54_42c6_4d39_bc4c_958b6bfaeb90/6y8efa6v6y8omskqeetyix8g_4.rem' has been disconnected or does not exist at the server.
at System.IO.FileStream.get_CanRead()
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.CheckFileAccessParameter(Stream stream, FileAccess access)
at MS.Internal.IO.Zip.ZipIOLocalFileBlock.GetStream(FileMode mode, FileAccess access)
at System.IO.Packaging.ZipPackagePart.GetStreamCore(FileMode mode, FileAccess access)
at System.IO.Packaging.PackagePart.GetStream(FileMode mode, FileAccess access)
at Microsoft.ServiceHosting.Tools.Packaging.Utils.CopyFullStreamToPart(Stream source, PackagePart part, PackageManifest manifest)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreateRolePackages(ModelProcessor modelProcessor, PackageManifest applicationManifest, Package applicationPackage)
at Microsoft.ServiceHosting.Tools.Packaging.PackageCreator.CreatePackage(Stream outputStream, Action`1 postProcess, PackageRestrictions restrictions)
at Microsoft.ServiceHosting.Tools.Packaging.ServiceApplicationPackage.CreateServiceApplicationPackage(String serviceModelFileName, String serviceDescriptionFile, Stream output, IPackageSecurity encrypt, Dictionary`2 namedStreamCollection, String userInfo, EventHandler`1 rolePackagePartAddedHandler)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.PackageCreator.CreateServiceApplicationPackage(String serviceRdFilePath, String processedServiceDefinitionFile, FileStream packageStream, Dictionary`2 namedStreams, Dictionary`2 rolesDictionary)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.TryCreatePackage(ServiceDefinitionModel sm)
at Microsoft.ServiceHosting.Tools.MSBuildTasks.CSPack.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
It is running on Windows Server 2008 R2, using MSBuild from VS2013 and the MSBuild is runnin like this parameters (from powershell):
& $msBuildPath "$tempPath\Azure\Azure.ccproj" /p:TargetProfile=Cloud /p:Configuration=Release /target:publish /flp:"Verbosity=quiet;logfile=E:\AzurePreview\msbuild.log"
I could not find anything connected to this issue.
I even tried to remove all traces of VS, SDKs and tools that might be connected to powershell, VS or Azure in general and installed the necessary parts again rebut nothing helped.
Could you please help me resolve this issue?
After discussing this issue with Microsoft support, I was able to package the project using CSPack command line tool, so I'm using this as a workaround.
Edit:
This issue seems fixed in Azure SDK 2.7

Unit testing with Roslyn.Services.Workspace results in a SecurityException while working at x86 target

I'm working on set of constants for my project, and I'd like to use roslyn to verify some of them in source code level. To achieve this, I'm loading entire solution using following snippet into AppDomain with IsFullyTrusted == true and IsHomogenous == true, i.e. remoting is enabled with x86 platform target:
// load workspace, i.e. solution from Visual Studio
var workspace = Roslyn.Services.Workspace.LoadSolution(solutionFile);
Test runners for NCrunch and NUnit with x86 platform with Roslyn
But while using either ncrunch 1.45 or nunit 2.6.2 nunit-console-x86.exe with platform configuration x86 as test runners, I'm constantly getting following System.Security.SecurityException:
System.Security.SecurityException : Type System.Runtime.Remoting.ObjRef and the types derived from it (such as System.Runtime.Remoting.ObjRef) are not permitted to be deserialized at this security level.
Server stack trace:
at System.Runtime.Serialization.FormatterServices.CheckTypeSecurity(Type t, TypeFilterLevel securityLevel)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.CheckSecurity(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Roslyn.Utilities.RemoteServices.Initialize(Int32 clientProcessId)
at Roslyn.Utilities.RemoteServices.StartRemoteServicesProcess()
at Roslyn.Utilities.RemoteServices.get_Instance()
at Roslyn.Utilities.RemoteServices.CreateInstance[T]()
at Roslyn.Services.Host.TemporaryStorageServiceFactory.CreateService(IWorkspaceServiceProvider workspaceServices)
at Roslyn.Services.Host.WorkspaceServiceProviderFactory.<>c__DisplayClass6.<OnImportsSatisfied>b__1(IWorkspaceServiceProvider wsp)
at Roslyn.Services.Host.WorkspaceServiceProvider.ConstructService(Type type)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at Roslyn.Services.Host.WorkspaceServiceProvider.GetService[TWorkspaceService]()
at Roslyn.Services.SolutionServices..ctor(IWorkspaceServiceProvider workspaceServices)
at Roslyn.Services.Solution..ctor(SolutionId id, String filePath, VersionStamp version, VersionStamp latestProjectVersion, IWorkspaceServiceProvider workspaceServices)
at Roslyn.Services.Host.SolutionFactoryServiceFactory.SolutionFactoryService.CreateSolution(SolutionId id)
at Roslyn.Services.Host.TrackingWorkspace.CreateNewSolution(ISolutionFactoryService solutionFactory, SolutionId id)
at Roslyn.Services.Host.TrackingWorkspace..ctor(IWorkspaceServiceProvider workspaceServiceProvider, Boolean enableBackgroundCompilation, Boolean enableInProgressSolutions)
at Roslyn.Services.Host.HostWorkspace..ctor(IWorkspaceServiceProvider workspaceServiceProvider, Boolean enableBackgroundCompilation, Boolean enableInProgressSolutions, Boolean enableFileTracking)
at Roslyn.Services.Host.LoadedWorkspace..ctor(IWorkspaceServiceProvider workspaceServiceProvider, IDictionary`2 globalProperties, Boolean enableBackgroundCompilation, Boolean enableFileTracking)
at Roslyn.Services.Host.LoadedWorkspace.LoadSolution(String solutionFileName, String configuration, String platform, Boolean enableFileTracking)
at Roslyn.Services.Workspace.LoadSolution(String solutionFileName, String configuration, String platform, Boolean enableFileTracking)
There is a discussion on NCrunch forum, but I have tried all following options without success:
Add [assembly: AllowPartiallyTrustedCallers] to AssemblyInfo.cs
Add [assembly: SecurityRules(SecurityRuleSet.Level1)] to AssemblyInfo.cs
Add <NetFx40_LegacySecurityPolicy enabled="true" /> to app.config
Run VS2012 as Administrator
Decorate both unittests and implementation with [SecuritySafeCritical]
Update: create new AppDomain and provide
PermissionState.Unrestricted, SecurityPermissionFlag.AllFlags and DataProtectionPermissionFlags.AllFlags
Add Host Evidence: SecurityZone.MyComputer, System.Security.Policy.Hash and System.Security.Policy.StrongName
Add all assemblies (both mine and Roslyn CTP) to fullTrustAssemblies while creating of AppDomain
Update #2
This exception happens only while I'm running test under x86 configuration, after I had switched to x64 platform configuration, everything seems to work fine
Question
Are there any other attributes or configuration changes to app.config or AppDomain that could help to enable deserialization in .NET Framework remoting for System.Runtime.Remoting.ObjRef while running under x86 configuration?
Temporary solution
Switch to x64 build configuration only for unittest project(s)
Source code
Whole source code is available at github: to reproduce error run following unittest using NCrunch IntrospectionTests.Introspection_SearchForComplexityGt10_ApprovedList
Discussion at NCrunch forum
Additional information
Also I notice...
A lot of instances of Roslyn.Services.dll hang in background, after all tests had been completed.
Lack of Host Evidences for NCrunch: System.Security.Policy.Hash and System.Security.Policy.StrongName with test runner assembly name
resharper MSIL (should be x64 inside) and nunit 2.6.2 nunit-console.exe test runner are working fine, so it looks like Roslyn configuration/remoting/security configuration issue.
It looks like ncrunch is executing the tests in Partial Trust, whereas Resharper is running them in Full Trust.
Roslyn has not been tested in Partial Trust scenarios. There are likely to be accesses to APIs that require Full Trust.
I haven't used ncrunch, but maybe there is a way to configure it to run the tests in Full Trust?
I want to add something!
After upgrading an NUnit instance I manage to run to both 2.6.2 and 2.6.3 of the software, my team ran into similar issues with this exact System.Security exception that Akim was seeing.
We were creating an IpcChannel with some of our custom NUnit logic that wasn't created with the right trust settings, so we had to change something that looked like:
IpcChannel channel = new IpcChannel(string.Format("localhost:{0}", portNum));
To -
BinaryServerFormatterSinkProvider serverProvider = new BinaryServerFormatterSinkProvider();
serverProvider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
BinaryClientFormatterSinkProvider clientProvider = new BinaryClientFormatterSinkProvider();
var properties = new System.Collections.Hashtable();
properties["name"] = "ipc";
properties["priority"] = "20";
properties["portName"] = string.Format("localhost:{0}", portNum);
IpcChannel channel = new IpcChannel(properties, clientProvider, serverProvider);
Just a quick fix I noticed that I figured I would forward to anybody seeing something similar that can't just switch their platform settings. To be fair, it took me about four hours to figure out so I didn't want the knowledge to go to waste.

"Argument: NotFound" error using Windows Authentication for Silverlight

A SL app created with SL Business Application template. Then Config it use Windows Authentication in web.Config as:
<authentication mode="Windows">
</authentication>
Code in App.xaml.cs to initialize authentication as:
webContext.Authentication = new WindowsAuthentication()
{ DomainContext = new MyRIAServices.Web.AuthenticationContext() };
then move this app to IIS and set website under IIS as Widnows Authentication.
Then Run this app, it is fine, It can get domain account (AD acount logged into windows).
Then move this app to anohter computer Windows 2008 R2 in the same domain. website under IIS configed exactly same as on windows 7. then access the sl app and got following error:
Load operation failed for query 'GetUser'.
[HttpWebRequest_WebException_RemoteServer]
Argument: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem.
See http://go.microsoft.com/fwlink/?linkid=106663&version=4.0.50917&File=System.Windows.dll&key=httpWebRequest_WebException_RemoteServer
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.<>c_DisplayClass1.b_0(Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete()
at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation)
at System.ServiceModel.DomainServices.Client.LoadOperation.<>c_DisplayClass41.<Create>b__0(LoadOperation1 arg)
at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c_DisplayClass1b.b__17(Object )
Caused by: Load operation failed for query 'GetUser'. [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.<>c_DisplayClass1.b_0(Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete()
at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation)
at System.ServiceModel.DomainServices.Client.LoadOperation.<>c_DisplayClass41.<Create>b__0(LoadOperation1 arg)
at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c_DisplayClass1b.b__17(Object )
Caused by: Load operation failed for query 'GetUser'. [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.<>c_DisplayClass1.b_0(Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete()
at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation)
at System.ServiceModel.DomainServices.Client.LoadOperation.<>c_DisplayClass41.<Create>b__0(LoadOperation1 arg)
at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c_DisplayClass1b.b__17(Object )
Caused by: Load operation failed for query 'GetUser'. [HttpWebRequest_WebException_RemoteServer]
Arguments: NotFound
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=System.Windows.dll&Key=HttpWebRequest_WebException_RemoteServer
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.End(IAsyncResult result)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.<>c_DisplayClass1.b_0(Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.RunInSynchronizationContext(SendOrPostCallback callback, Object state)
at System.ServiceModel.DomainServices.Client.ApplicationServices.AuthenticationOperation.HandleAsyncCompleted(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.AsyncResultBase.Complete()
at System.ServiceModel.DomainServices.Client.ApplicationServices.WebAuthenticationService.HandleOperationComplete(OperationBase operation)
at System.ServiceModel.DomainServices.Client.LoadOperation.<>c_DisplayClass41.<Create>b__0(LoadOperation1 arg)
at System.ServiceModel.DomainServices.Client.LoadOperation`1.InvokeCompleteAction()
at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)
at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)
at System.ServiceModel.DomainServices.Client.DomainContext.<>c_DisplayClass1b.b__17(Object )
How to fix this problem?
Deploying Silverlight 4 applications with WCF RIA Services can be really a nightmare! But here is solution!
Setup your server (e.g. MS Windows Server 2008 R2, IIS7) for Silverlight 4 and WCF RIA Services:
1) Download and install the .NET 4 Framework Web Platform Installer.
Use the installer to install the .NET 4 Framework. Reboot the server after this completes.
2) Download WCF RIA Services to your local machine (e.g. c:\temp).
Open up a command window (I used "Run as Administrator"). Go to the folder with the MSI file (e.g. c:\temp) and
type the following command to launch the install of WCF RIA Services:
msiexec /i RiaServices.msi SERVER=TRUE
3) To remove anoying error [HttpWebRequest_WebException_RemoteServer] do the following:
go to the command prompt, open the Microsoft.NET\Framework64 folder
(e.g. C:\Windows\Microsoft.NET\Framework64\v4.0.30319) and execute the following commands:
servicemodelreg -ia
aspnet_regiis -i
iisreset
This corrects the installation issue and WCF RIA Services works as expected.
Regards,
Matjaz Bravc, MCPD