Ninject.MVC3 + MediumTrust = Security Exception - ninject

I created a new project of type Asp.net MVC 4
I installed the package via Ninject.MVC3 NuGet Install Package Ninject.MVC3
When running the project, security error:
Error
Server Error in '/MediumTrustSample' Application.
Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the
required permission please contact your system administrator or change
the application's trust level in the configuration file.
Exception Details: System.Security.SecurityException: Request for the
permission of type 'System.Security.Permissions.ReflectionPermission,
mscorlib, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' failed.
Source Error:
Line 20:
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestModule)); Line
21:
DynamicModuleUtility.RegisterModule(typeof(HttpApplicationInitializationModule));
Line 22: bootstrapper.Initialize(CreateKernel); Line 23:
} Line 24:
Source File: C:\Users\Riderman_2\Documents\Visual Studio
2010\Projects\MediumTrustSample\MediumTrustSample\App_Start\NinjectMVC3.cs
Line: 22
Stack Trace:
[SecurityException: Request for the permission of type
'System.Security.Permissions.ReflectionPermission, mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.]
System.Security.CodeAccessSecurityEngine.SpecialDemand(PermissionType
whatPermission, StackCrawlMark& stackMark) +0
System.Security.CodeAccessPermission.Demand(PermissionType
permissionType) +30
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture,
Boolean skipVisibilityChecks) +281
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
+38 Ninject.Infrastructure.Language.ExtensionsForMemberInfo.GetParentDefinition(MethodInfo
method, BindingFlags flags) in ExtensionsForMemberInfo.cs:145
Ninject.Infrastructure.Language.ExtensionsForMemberInfo.IsDefined(PropertyInfo
element, Type attributeType, Boolean inherit) in
ExtensionsForMemberInfo.cs:173
Ninject.Selection.Heuristics.StandardInjectionHeuristic.ShouldInject(MemberInfo
member) in StandardInjectionHeuristic.cs:47
Ninject.Selection.<>c_DisplayClass3.b_2(IInjectionHeuristic h) in Selector.cs:92 System.Linq.Enumerable.Any(IEnumerable1
source, Func2 predicate) +149
Ninject.Selection.Selector.b_1(PropertyInfo
p) in Selector.cs:92
System.Linq.WhereEnumerableIterator1.MoveNext() +156
System.Collections.Generic.List1.InsertRange(Int32 index,
IEnumerable1 collection) +552
Ninject.Selection.Selector.SelectPropertiesForInjection(Type type) in
Selector.cs:89
Ninject.Planning.Strategies.PropertyReflectionStrategy.Execute(IPlan
plan) in PropertyReflectionStrategy.cs:60
Ninject.Planning.<>c__DisplayClass3.<GetPlan>b__1(IPlanningStrategy s)
in Planner.cs:68
Ninject.Infrastructure.Language.ExtensionsForIEnumerableOfT.Map(IEnumerable1
series, Action1 action) in ExtensionsForIEnumerableOfT.cs:23
Ninject.Planning.Planner.GetPlan(Type type) in Planner.cs:70
Ninject.Activation.Context.Resolve() in Context.cs:180
Ninject.KernelBase.<Resolve>b__7(IContext context) in
KernelBase.cs:375
System.Linq.WhereSelectEnumerableIterator2.MoveNext() +238
System.Linq.Enumerable.SingleOrDefault(IEnumerable1 source) +299
Ninject.Planning.Targets.Target1.GetValue(Type service, IContext
parent) in Target.cs:179
Ninject.Planning.Targets.Target1.ResolveWithin(IContext parent) in
Target.cs:147
Ninject.Activation.Providers.StandardProvider.GetValue(IContext
context, ITarget target) in StandardProvider.cs:97
System.Linq.WhereSelectArrayIterator2.MoveNext() +110
System.Linq.Buffer1..ctor(IEnumerable1 source) +488
System.Linq.Enumerable.ToArray(IEnumerable1 source) +104
Ninject.Activation.Providers.StandardProvider.Create(IContext context)
in StandardProvider.cs:81 Ninject.Activation.Context.Resolve() in
Context.cs:157 Ninject.KernelBase.<Resolve>b__7(IContext context)
in KernelBase.cs:375
System.Linq.WhereSelectEnumerableIterator2.MoveNext() +238
System.Linq.d_b11.MoveNext() +296
System.Linq.Enumerable.Single(IEnumerable1 source) +282
Ninject.ResolutionExtensions.Get(IResolutionRoot root, IParameter[]
parameters) in ResolutionExtensions.cs:37
Ninject.Web.Mvc.Bootstrapper.Initialize(Func`1 createKernelCallback)
in Bootstrapper.cs:72
MediumTrustSample.App_Start.NinjectMVC3.Start() in
C:\Users\Riderman_2\Documents\Visual Studio
2010\Projects\MediumTrustSample\MediumTrustSample\App_Start\NinjectMVC3.cs:22
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.272
Question
How to use Ninject.MVC3 with MediumTrust?

Go and get the medium trust version: https://github.com/ninject/ninject/downloads

Related

Cannot Scaffold DBContext after installing Microsoft.EntityFrameworkCore, Version=5.0.0.0

So I recently installed Entity Framework Core 5.0 Preview 3 because I needed to use Filtered Include.
source : https://devblogs.microsoft.com/dotnet/announcing-entity-framework-core-5-0-preview-3/
Now I had to alter a table in my Database, and naturally, I executed this command in PackagaManagerConsole:
Scaffold-DbContext "Server=<Server Name>;Initial Catalog=<Database Name>;User ID=<user id>;Password=<password>;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Entity -Project <project Name> -force
usually it works fine and the DBContext is updated.
But now I'm getting the following exception:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.TypeLoadException: Could not load type 'Microsoft.EntityFrameworkCore.Internal.SemanticVersionComparer' from assembly 'Microsoft.EntityFrameworkCore, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at Microsoft.EntityFrameworkCore.Design.OperationExecutor..ctor(IOperationReportHandler reportHandler, IDictionary args)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
at Microsoft.EntityFrameworkCore.Tools.Commands.DbContextScaffoldCommand.Execute()
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
I tried updating theses packages to the latest version :
Microsoft.EntityFrameworkCore ---> 3.1.8
Microsoft.EntityFrameworkCore.Design ---> 3.1.8
Microsoft.EntityFrameworkCore.Relational ---> 3.1.8
Microsoft.EntityFrameworkCore.SQLServer ---> 3.1.8
Microsoft.EntityFrameworkCore.Tools ---> 3.1.8
but I'm still getting the exception.
what should I do? I like having Filtered Include, so I don't want to uninstall the latest efcore preview.
So I went back and read the article that I referenced in the question, and I tried using developer command prompt instead of package manager console to scaffold the DBcontext.
I executed this command :
`dotnet ef dbcontext scaffold "server=<servername>;database=<database>;user=<user>;password=<password>" Microsoft.EntityFrameworkCore.SqlServ
er --project "DataAccess" --output-dir "Models" --force`
and it worked without problems.
but I still can't understand why that heppened.

SID of the target principal could not be resolved.

I delpoyed my web application (which uses LDAP) on windows server 2016. It is throwing below error. Though I am able to access same ADLDS instance using ADSI or C# console application (created utility to test connectivity). But not sure why its throwing error with web application. Please suggest.
Server Error in '/' Application.
**While trying to resolve a cross-store reference, the SID of the target principal could not be resolved. The error code is 1722.**
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.DirectoryServices.AccountManagement.PrincipalOperationException: While trying to resolve a cross-store reference, the SID of the target principal could not be resolved. The error code is 1722.
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:
[PrincipalOperationException: While trying to resolve a cross-store reference, the SID of the target principal could not be resolved. The error code is 1722.]
System.DirectoryServices.AccountManagement.ADStoreCtx.ResolveCrossStoreRefToPrincipal(Object o) +570
System.DirectoryServices.AccountManagement.ADUtils.DirectoryEntryAsPrincipal(DirectoryEntry de, ADStoreCtx storeCtx) +133
System.DirectoryServices.AccountManagement.ADDNLinkedAttrSet.get_CurrentAsPrincipal() +86
System.DirectoryServices.AccountManagement.PrincipalCollectionEnumerator.MoveNext() +252
System.DirectoryServices.AccountManagement.PrincipalCollectionEnumerator.System.Collections.IEnumerator.MoveNext() +9
System.Linq.<SelectManyIterator>d__22`3.MoveNext() +65
System.Linq.Lookup`2.Create(IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer) +264
System.Linq.GroupedEnumerable`3.GetEnumerator() +72
System.Linq.WhereSelectEnumerableIterator`2.MoveNext() +63
System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection) +392
System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection) +15
Plastin.Common.Security.ADLDSClaimsProvider.SetApplicationClaims() +1012
Plastin.Common.Security.ADLDSClaimsProvider.Initialise() +174
Plastin.Common.Security.ADLDSClaimsProvider..cctor() +238
[TypeInitializationException: The type initializer for 'Plastin.Common.Security.ADLDSClaimsProvider' threw an exception.]
lambda_method(Closure , IBuilderContext ) +81
Microsoft.Practices.ObjectBuilder2.<>c__DisplayClass1.<GetBuildMethod>b__0(IBuilderContext context) +35
Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlan.BuildUp(IBuilderContext context) +10
Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) +198
Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) +209
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +165
[ResolutionFailedException: Resolution of the dependency failed, type = "Plastin.Common.Security.IClaimsProvider", name = "(none)".
Exception occurred while: Calling constructor Plastin.Common.Security.ADLDSClaimsProvider().
Exception is: TypeInitializationException - The type initializer for 'Plastin.Common.Security.ADLDSClaimsProvider' threw an exception.
-----------------------------------------------
At the time of the exception, the container was:
Resolving Plastin.Common.Security.ADLDSClaimsProvider,(none) (mapped from Plastin.Common.Security.IClaimsProvider, (none))
Calling constructor Plastin.Common.Security.ADLDSClaimsProvider()
]
Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) +329
Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides) +15
Microsoft.Practices.Unity.UnityContainerExtensions.Resolve(IUnityContainer container, ResolverOverride[] overrides) +72
Plastin.Common.Security.AuthenticationManager.Authenticate(String resourceName, ClaimsPrincipal incomingPrincipal) +149
Plastin.Portal.MvcApplication.Application_PostAuthenticateRequest() +70
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments) +87
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +101
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +21
System.Web.Util.ArglessEventHandlerProxy.Callback(Object sender, EventArgs e) +56
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +141
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69
Finally we fixed this issue and my apologies I am getting late to answer this question. After lots of debugging we identified that our web application was throwing this error while getting members of ADLDS group. It was unusual as same application was working on other server. So we decided to captured network traffic using Wireshark. Wireshark capture indicated that connectivity between LDAP server and application server was blocked over SMB port 445. So we get our Network team to open port 445 which fixed the issue.
This error seems very generic error and could be other reasons for this error in your scenario but using network traffic capturing tool (like wireshark) at early stage of investigation might help you to troubleshoot these kind of issue quickly.

How to fix 'Access Denied' error with a .Net WCF service running on Amazon EC2?

I am new to the AWC/EC2 environment and created a .Net WCF service on my EC2 instance of Windows Server and IIS.
Navigating to http://www.websiteservice.com/MyWebsiteFeederService.svc?wsdl brings up the WSDL.
Now, in www.mywebsite.com, that is also sitting on the same machine, I have consumed the web service. Unfortunately whenever I try to access the service through the site, I continue to receive the "Access is Denied" error message:
Exception Details:
System.ServiceModel.Security.SecurityAccessDeniedException: Access is
denied.
I don't believe this is related to the AWS-S3 error - Access is Denied error, as I am not using buckets.
In the site's Web.config, I turned on the trace listener and took a look at the Service Trace Viewer.
The information doesn't seem to be useful, as this is what I get:
[TraceRecord] Severity Warning
TraceIdentifier http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx
Description Throwing an exception.
AppDomain /LM/W3SVC/4/ROOT-2-129966419874659765
Here is the full XML of Warning level:
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>131075</EventID>
<Type>3</Type>
<SubType Name="Warning">0</SubType>
<Level>4</Level>
<TimeCreated SystemTime="2012-11-06T02:19:47.8029428Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{b6efab70-63ad-4bdd-85c6-5c49a907c210}" />
<Execution ProcessName="w3wp" ProcessID="3472" ThreadID="1" />
<Channel />
<Computer>AMAZONA-xxxxxFFR</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Warning">
<TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>/LM/W3SVC/4/ROOT-2-129966419874659765</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.Security.SecurityAccessDeniedException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Access is denied.</Message>
<StackTrace>
at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at MyWebsiteFeederService.IFeederService.GetWebsiteConfiguration(String websiteGuid, String websitePW)
at MyWebsiteFeederService.FeederServiceClient.GetWebsiteConfiguration(String websiteGuid, String websitePW)
at Inquiro.Models4.ModelsBaseClass.GetWebsiteConfiguration(String websiteGuid, String websitePW)
at Inquiro.Websites.MvcApplication.LoadWebsiteConfiguration()
at Inquiro.Websites.MvcApplication.Application_Start()
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at System.Web.HttpApplication.InvokeMethodWithAssert(MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs)
at System.Web.HttpApplication.ProcessSpecialRequest(HttpContext context, MethodInfo method, Int32 paramCount, Object eventSource, EventArgs eventArgs, HttpSessionState session)
at System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app)
at System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers)
at System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context)
at System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context)
at System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)
</StackTrace>
<ExceptionString>System.ServiceModel.Security.SecurityAccessDeniedException: Access is denied.</ExceptionString>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
I have the exact same service running on another, non-Amazon server and it is working fine. I don't recall setting up any special permissions, or "run as [user]" - have no additional users setup in IIS Manager Permissions.
I have also confirmed from the command prompt on that server, using sqlcmd, that I can connect to the RDS database server.
I'm basically going in circles at this point and would appreciate some assistance.
Thanks.
The error itself "Access is denied." isn't very helpful. Neither is the debug information.
Ultimately, in this case, the issue was that execute permissions needed to be granted to the userID that was executing the stored procedures called from the WCF service.

Failed to load assembly, 0 bytes from System, BadImageFormatException

We've install .Net 4.0 Full at a client site. Current System.dll version is 4.0.30319.236.
Our test application opens without a problem and I initiate a simple "echo" to a WCF service on the same network. However, I get this nasty error when the service call is invoked:
Creating proxy
calling service method
ERROR: exception during service call and response process: Could not load file or assembly '0 bytes loaded from System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. An attempt was made to load a program with an incorrect format.
System.BadImageFormatException
Stack trace:
Server stack trace:
at System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, SecurityContextSource securityContextSource)
at System.Reflection.Assembly.Load(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence securityEvidence)
at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters options, String[] fileNames)
at Microsoft.CSharp.CSharpCodeGenerator.FromSourceBatch(CompilerParameters options, String[] sources)
at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler.CompileAssemblyFromSourceBatch(CompilerParameters options, String[] sources)
at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromSource(CompilerParameters options, String[] sources)
at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.XmlSerializer.GetSerializersFromCache(XmlMapping[] mappings, Type type)
at System.Xml.Serialization.XmlSerializer.FromMappings(XmlMapping[] mappings, Type type)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GenerateSerializers()
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.SerializerGenerationContext.GetSerializer(Int32 handle)
at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.MessageInfo.get_BodySerializer()
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter writer, MessageVersion version, String action, MessageDescription messageDescription, Object returnValue, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter writer, MessageVersion version, Object[] parameters, Object returnValue, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter writer)
at System.ServiceModel.Channels.BufferedMessageWriter.WriteMessage(Message message, BufferManager bufferManager, Int32 initialOffset, Int32 maxSizeQuota)
at System.ServiceModel.Channels.BinaryMessageEncoderFactory.BinaryMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset)
at Microsoft.Samples.CompressionEncoder.MyCompressionMessageEncoderFactory.MyCompressionMessageEncoder.WriteMessage(Message message, Int32 maxMessageSize, BufferManager bufferManager, Int32 messageOffset) in C:\Projects\TariffServices\TariffService\Source\Service Interface\CompressionEncoder\MyCompressionMessageEncoderFactory.cs:line 163
at System.ServiceModel.Channels.FramingDuplexSessionChannel.EncodeMessage(Message message)
at System.ServiceModel.Channels.FramingDuplexSessionChannel.OnSend(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.OutputChannel.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.TransactionDuplexChannelGeneric`1.Send(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
We've re-installed the framework numerous times, I've tried re-ngen'ing the System.dll. Nothing works.
I've run the .Net setup verification tools, comes back with no errors.
The System.dll has a size of 3 510 600 bytes.
On the server machine (hosting the WCF service), everything is fine. The .Net version on that machine is also 4.0.30319.236.
Both machines are on WinXP 32bit Professional SP3, 2GB RAM.
Any ideas?
Thanks,
Chris
We've shelved this problem for now. There seems to be more wrong with this PC than meets the eye. We've recommended a re-format and installation of WinXP.
The problem can be connected to problem with csc.exe (used by code generator) not producing any output. Check this url for how to fix the issue: http://www.nooto.com/2011/02/net-framework-error-could-not-load-file-or-assembly/

Error running FitNesse Web Test Examples

I've just downloaded FitNesse WebTest and ran into this issue after starting FitNesse and SeleniumRC.
start browser
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:4444
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at Selenium.HttpCommandProcessor.DoCommand(String command, String[] args)
at Selenium.HttpCommandProcessor.GetString(String commandName, String[] args)
at Selenium.HttpCommandProcessor.Start()
at Selenium.DefaultSelenium.Start()
at com.neuri.webfixture.PlainSeleniumTest.startBrowser(String browser, String rcServer, Int32 rcPort, String seleniumURL)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at fitlibrary.Method.Invoke(Object[] theParameters)
at fitlibrary.Method.Invoke(Fixture theFixture, IEnumerable theCells)
at fitlibrary.FlowFixtureBase.ExecuteMethod(Method theMethod, CellRange theCells)
at fitlibrary.FlowFixtureBase.ProcessFlowRows(Parse theRows)
Any help would be appreciated to get past this as it's driving me mad.
Sounds like you haven't started the selenium server, start it using
java -jar c:\selenium\selenium-server.jar
assuming you have installed selenium in the default location.