AD FS login with Django fails with Error code 364 - adfs

I am trying to connect my Django app to AD FS.
Note: All domain names used a fake/internal
I can login fine (/adfs/ls/idpinitiatedSignOn.aspx)
BUT not after integration with an app
Connector Lib used: django-saml2-auth https://github.com/fangli/django-saml2-auth
When I try to log in I am redirected to
https://win-sh2hfr5t2r9.dtest.com/adfs/ls/?SAMLRequest=nZLNTsMwEIRfJfI9cWL112oqFaqKSAWiJlQVF%2BQmLrGU2MW7Ke3b46TAgUMP3Lzrmc%2BzK880hHzRYqU38qOVgN65qTVw145JazU3ApQrRSOBY8GzxeOasyDkR2vQFKYmv4botkEASIvKaOItfo73RkPbSJtJe1KFfNmsY1IhHjml0ZQF0WgSRMGYTyIKoqnZm3BBqSiAEm%2FpsiotOsrVA870qbQPFasOdojMToMSnSooTENFeQBad8ZkGRNV%2Bsddyvan1R522TjfnjcuVgLQykQDCo0xYSEL%2FZD5bJJHQz4Y8cH0lXjp99h3SpdKv98eeX8VAX%2FI89RPn7OceFtpoc%2FsBGQ%2Bc2vj%2FbvWWxnbCLxN7Dou%2FKGXcqlR4YV4tOOE%2FMldJsvU1Kq4%2FIOGVmhQjtkD6d%2BPMf8C
AD FS Error Log below
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="AD FS" Guid="{2FFB687A-1571-4ACE-8550-47AB5CCAE2BC}" />
<EventID>364</EventID>
<Version>0</Version>
<Level>2</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000001</Keywords>
<TimeCreated SystemTime="2020-02-28T16:10:03.589483500Z" />
<EventRecordID>63</EventRecordID>
<Correlation ActivityID="{00000000-0000-0000-9500-0080010000D0}" />
<Execution ProcessID="4064" ThreadID="3820" />
<Channel>AD FS/Admin</Channel>
<Computer>WIN-SH2HFR5T2R9.dtest.com</Computer>
<Security UserID="S-1-5-21-2884057814-3114364144-2287182707-1113" />
</System>
<UserData>
<Event xmlns="http://schemas.microsoft.com/ActiveDirectoryFederationServices/2.0/Events">
<EventData>
<Data />
<Data />
<Data>System.Xml.XmlException: ID4125: An error occurred reading XML data. ---> System.ArgumentNullException: Value cannot be null. Parameter name: value at Microsoft.IdentityModel.Tokens.Saml2.Saml2NameIdentifier.set_Value(String value) at Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ReadNameIDType(XmlReader reader) --- End of inner exception stack trace --- at Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ReadNameIDType(XmlReader reader) at Microsoft.IdentityServer.Protocols.Saml.Saml2AssertionSerializer.ReadIssuer(XmlReader reader) at Microsoft.IdentityServer.Protocols.Saml.SamlProtocolSerializer.ReadCommonElements(XmlReader reader, SamlMessage message) at Microsoft.IdentityServer.Protocols.Saml.SamlProtocolSerializer.ReadAuthnRequest(XmlReader reader) at Microsoft.IdentityServer.Protocols.Saml.HttpSamlBindingSerializer.ReadProtocolMessage(String encodedSamlMessage) at Microsoft.IdentityServer.Protocols.Saml.HttpSamlBindingSerializer.CreateFromNameValueCollection(Uri baseUrl, NameValueCollection collection) at Microsoft.IdentityServer.Protocols.Saml.HttpRedirectSamlBindingSerializer.ReadMessage(Uri requestUrl, NameValueCollection form) at Microsoft.IdentityServer.Web.Protocols.Saml.HttpSamlMessageFactory.CreateMessage(WrappedHttpListenerRequest httpRequest) at Microsoft.IdentityServer.Web.Protocols.Saml.SamlContextFactory.CreateProtocolContextFromRequest(WrappedHttpListenerRequest request, ProtocolContext& protocolContext) at Microsoft.IdentityServer.Web.Protocols.Saml.SamlProtocolHandler.CreateProtocolContext(WrappedHttpListenerRequest request) at Microsoft.IdentityServer.Web.PassiveProtocolListener.GetProtocolHandler(WrappedHttpListenerRequest request, ProtocolContext& protocolContext, PassiveProtocolHandler& protocolHandler) at Microsoft.IdentityServer.Web.PassiveProtocolListener.OnGetContext(WrappedHttpListenerContext context) System.ArgumentNullException: Value cannot be null. Parameter name: value at Microsoft.IdentityModel.Tokens.Saml2.Saml2NameIdentifier.set_Value(String value) at Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ReadNameIDType(XmlReader reader)</Data>
</EventData>
</Event>
</UserData>
</Event>
I have even added Incoming Claim Transformation

The issue seems to be with your service provider Metadata. Check is your enityt id, name-id format and security array is correct. As teh log suggests the issue is with your xml data, so there is some mismatch at IDP and SP end.

Related

ASP.NET Framework web app setting contract to null when file is "large"

I have an ASP.NET framework web application that processes documents and returns it in a template contract. If I send it a smaller document (143KB) it processes fine and sets the template contract properly (ie. template contract is not null):
Template set properly for smaller file
If I try a larger file (5MB), it receives the request but the template contract is null:
Template contract set to null for larger file
This is the code where the template object is recieved:
[Route("v2/document")]
[HttpPost]
public IHttpActionResult ReportsV2([FromBody] Template template)
{
if (template.Data == null && string.IsNullOrEmpty(template.ConnectionString))
{
if (Log.IsDebugEnabled)
{
LogDebugHeaders();
LogRawIncomingContent();
}
throw new ReportGeneratorException("Template not provided. Specify the Data or Uri element.");
}
So when I use the larger file it hits the conditional statement and throws an error.
Ive also added the following lines to the following lines to the web.config but still got the error:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="2147483648" />
</requestFiltering>
</security>
This is the exception I get:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=RESTfulEngine
StackTrace:
at RESTfulEngine.Controllers.ReportsController.ReportsV2(Template template) in C:\Jenova\restfulengine\RESTfulEngine\Controllers\ReportsController.cs:line 95
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.<GetExecutor>b__2(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
Any ideas as to why this is happening?

NLog throws 'Target cannot be found' for any custom target running on Azure Web App

I've created two NLog custom targets on .NET Standard 2.0, and imported them into an existing ASP.NET 4.7.2 website.
nlog.config looks like this:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info"
internalLogFile="${basedir}/internal-nlog.txt"
throwExceptions="true"
throwConfigExceptions="true">
<extensions>
<add assembly="MyAssembly"/>
</extensions>
<targets async="false">
<target name="logconsole" xsi:type="Console" />
<target xsi:type="AzureTableTarget"
name="azureTable"
// some configs
/>
<target xsi:type="PostmarkLogTarget"
name="postmark"
// some configs
/>
</targets>
<rules>
<logger name="*" minlevel="Warn" writeTo="postmark" />
<logger name="*" minlevel="Info" writeTo="azureTable" />
<logger name="*" minlevel="Debug" writeTo="logconsole" />
</rules>
</nlog>
When the app starts locally, everything works fine. When it starts on the Azure App Service, I get this in the nlog internal log (and a big, fat error page):
2019-06-21 15:08:53.5719 Info Message Template Auto Format enabled
2019-06-21 15:08:53.6015 Info Loading assembly: MyAssembly
2019-06-21 15:08:53.6926 Info Adding target ConsoleTarget(Name=logconsole)
2019-06-21 15:08:53.7595 Error Parsing configuration from D:\home\site\wwwroot\NLog.config failed. Exception: NLog.NLogConfigurationException: Exception when parsing D:\home\site\wwwroot\NLog.config. ---> System.ArgumentException: Target cannot be found: 'AzureTableTarget'
at NLog.Config.Factory`2.CreateInstance(String itemName)
at NLog.Config.LoggingConfigurationParser.ParseTargetsElement(ILoggingConfigurationElement targetsElement)
at NLog.Config.LoggingConfigurationParser.ParseNLogSection(ILoggingConfigurationElement configSection)
at NLog.Config.XmlLoggingConfiguration.ParseNLogSection(ILoggingConfigurationElement configSection)
at NLog.Config.LoggingConfigurationParser.LoadConfig(ILoggingConfigurationElement nlogConfig, String basePath)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(ILoggingConfigurationElement nlogElement, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors)
--- End of inner exception stack trace ---
2019-06-21 15:08:53.8489 Error Failed loading from config file location: D:\home\site\wwwroot\NLog.config Exception: NLog.NLogConfigurationException: Exception when parsing D:\home\site\wwwroot\NLog.config. ---> System.ArgumentException: Target cannot be found: 'AzureTableTarget'
at NLog.Config.Factory`2.CreateInstance(String itemName)
at NLog.Config.LoggingConfigurationParser.ParseTargetsElement(ILoggingConfigurationElement targetsElement)
at NLog.Config.LoggingConfigurationParser.ParseNLogSection(ILoggingConfigurationElement configSection)
at NLog.Config.XmlLoggingConfiguration.ParseNLogSection(ILoggingConfigurationElement configSection)
at NLog.Config.LoggingConfigurationParser.LoadConfig(ILoggingConfigurationElement nlogConfig, String basePath)
at NLog.Config.XmlLoggingConfiguration.ParseNLogElement(ILoggingConfigurationElement nlogElement, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.ParseTopLevel(NLogXmlElement content, String filePath, Boolean autoReloadDefault)
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors)
--- End of inner exception stack trace ---
at NLog.Config.XmlLoggingConfiguration.Initialize(XmlReader reader, String fileName, Boolean ignoreErrors)
at NLog.Config.XmlLoggingConfiguration..ctor(XmlReader reader, String fileName, Boolean ignoreErrors, LogFactory logFactory)
at NLog.Config.LoggingConfigurationFileLoader.LoadXmlLoggingConfiguration(XmlReader xmlReader, String configFile, LogFactory logFactory)
at NLog.Config.LoggingConfigurationFileLoader.LoadXmlLoggingConfigurationFile(LogFactory logFactory, String configFile)
at NLog.Config.LoggingConfigurationFileLoader.TryLoadLoggingConfiguration(LogFactory logFactory, String configFile, LoggingConfiguration& config)
2019-06-21 15:08:54.1153 Info Configuring from an XML element in D:\home\site\wwwroot\NLog.config...
2019-06-21 15:08:54.1457 Info Message Template Auto Format enabled
2019-06-21 15:08:54.1457 Info Loading assembly: MyAssembly
2019-06-21 15:08:54.1457 Info Adding target ConsoleTarget(Name=logconsole)
2019-06-21 15:08:54.3332 Info Adding target AzureTableTarget(Name=azureTable)
2019-06-21 15:08:54.3525 Info Adding target PostmarkLogTarget(Name=postmark)
2019-06-21 15:08:54.4120 Info Found 38 configuration items
2019-06-21 15:08:54.4738 Info Configuration initialized.
The second load comes about because I have code in global.asax.cs to register and configure the targets specifically. This code fires immediately after setting up AutoFac, and before anything tries to log to anywhere.
Running locally, the code proceeds through these steps in order, even in Release mode. It looks like it tries to log a message before configuration has completed when running on Azure.
Even if that were the case, both custom targets have default public constructors, so NLog should be able to instantiate them automagically. (Which is why I reload configs after setting up the targets.)
Two questions:
What is different about the Azure App Service that causes (or allows) NLog to jump the gun like that?
Short of removing nlog.config and setting up logging in code, how can I prevent this behavior from happening?
Target cannot be found: 'AzureTableTarget'
This mean that the target class 'AzureTableTarget' cannot be found in one of the assemblies and thus an instance cannot be create.
You need to tell NLog in which assembly the AzureTableTarget type could be found.
Something like this:
<extensions>
<add assembly="AssemblyNameWhereAzureTableTargetIsDefined"/>
</extensions>
What is different about the Azure App Service that causes (or allows) NLog to jump the gun like that?
Are the same assemblies available? So is the assembly with the AzureTableTarget published?
Short of removing nlog.config and setting up logging in code
For this case it doesn't matter if NLog is configured from file or from code.
how can I prevent this behavior from happening?
Always add all external NLog extensions to <extensions>
Last but not least, throwExceptions="true" isn't recommend for production! (If your logging breaks, do you really like that your application breaks?)
Found it. Wow.
I had this code hanging out in a .cs file:
public static readonly Logger Logger = LogManager.GetCurrentClassLogger();
On the App Service deployment, the static constructor of the class containing that line ran before App_Start had finished. On my local box, it didn't.
So I changed it to this:
public static Logger Logger => _logger ?? (_logger = LogManager.GetCurrentClassLogger());
private static Logger _logger;
...and everything works now. The Logger is only created when used, not just because ASP.NET wanted to instantiate static classes ahead of time.

Share ADFS/WIF federated claims cookie on multiple virtual applications (but the same domain)

I'm trying to (re)use ADFS 2/WIF claims based authentication cookies for multiple different applications running on the same domain.
So I have these applications/virtual directories that I would like to reuse the same authentication cookie:
https://domain.local/portal
https://domain.local/myapp
In the portal, I'd like to include (client side authenticated) content from myapp, so I don't want every app to be authenticated separately with a redirect to STS/ADFS.
I thought this would be pretty straightforward as they could both access the same cookie as they reside on the same domain, but the cookie is only valid for the application it was created in (FedAuth and FedAuth1 cookie paths are restricted to "/portal/")
When I set the 'path' in the cookieHandler settings to "/", I will get an exception:
[SecurityTokenException: ID4291: The security token 'System.IdentityModel.Tokens.SessionSecurityToken' is not scoped to the current endpoint.]
System.IdentityModel.Tokens.SessionSecurityTokenHandler.ValidateToken(SessionSecurityToken token, String endpointId) +1008632
System.IdentityModel.Services.SessionAuthenticationModule.ValidateSessionToken(SessionSecurityToken sessionSecurityToken) +351
System.IdentityModel.Services.SessionAuthenticationModule.SetPrincipalFromSessionToken(SessionSecurityToken sessionSecurityToken) +91
System.IdentityModel.Services.SessionAuthenticationModule.AuthenticateSessionSecurityToken(SessionSecurityToken sessionToken, Boolean writeCookie) +66
System.IdentityModel.Services.SessionAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs eventArgs) +929
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
I've tried to use the Microsoft.Owin.Security.WsFederation beta packages mentioned in this article as an alternative, no success getting this running:
http://blogs.msdn.com/b/webdev/archive/2014/02/21/using-claims-in-your-web-app-is-easier-with-the-new-owin-security-components.aspx
Before I'm going to try to override methods in the SessionSecurityTokenHandler, is it even possible what I'm trying to achieve?
Thanks in advance!
Change cookieHandler as below in system.identityModel.services --> federationConfiguration
<federatedAuthentication>
<cookieHandler requireSsl="true" path="/" />
</federatedAuthentication>
It was actually pretty simple to do it, by replacing MachineKeySessionSecurityTokenHandler with a custom implementation that get's rid of the token validation:
public class SharedSecurityTokenHandler : MachineKeySessionSecurityTokenHandler
public override ReadOnlyCollection<ClaimsIdentity> ValidateToken(SessionSecurityToken token, string endpointId)
{
if (token == null) throw new ArgumentNullException("token");
if (endpointId == null) throw new ArgumentNullException("endpointId");
return ValidateToken(token);
}
}
the just registering it here in the web.config:
<system.identityModel>
<identityConfiguration>
<securityTokenHandlers>
<add type="Security.Web.SharedSecurityTokenHandler, Security.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</securityTokenHandlers>
</identityConfiguration>
</system.identityModel>
I've been trying to achieve the same thing and found that SessionAuthenticationModule.ValidateSessionToken(SessionSecurityToken sessionSecurityToken) calls:
securityTokenHandler.ValidateToken(sessionSecurityToken, this.CookieHandler.Path)
..where the second argument is endpointId. Therefore, configuring both my apps with:
<system.identityModel.services>
<federationConfiguration>
<cookieHandler domain="example.com" path="/" />
...
</federationConfiguration>
</system.identityModel.services>
..allowed the validation in MachineKeySessionSecurityTokenHandler to pass.

Error in configuring ambient data framework for Content Delivery web Service

I am configuring ambient data framework for Content Delivery web Service it is throwing below error when I hit my service url in browser
Server Error in '/' Application.
Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1
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:
Com.Tridion.Ambientdata.AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1
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:
[AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1]
Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +373
Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1364
Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, JavaMethodArguments args) +524
Com.Tridion.Ambientdata.EngineFactory.NewEngine(AmbientDataConfig ambientDataConfig) +126
Tridion.ContentDelivery.AmbientData.HttpModule.InitializeAmbientFramework() +144
Tridion.ContentDelivery.AmbientData.HttpModule.Init(HttpApplication application) +60
System.Web.HttpApplication.InitModulesCommon() +172
System.Web.HttpApplication.InitModules() +43
System.Web.HttpApplication.InitInternal(HttpContext context, HttpApplicationState state, MethodInfo[] handlers) +828
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +304
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +107
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +327
Below is my cd_ambient_cartridge_conf.xml file:
cd_ambient_cartridge_conf.xml
<?xml version="1.0" encoding="UTF-8"?>
<CartridgeDefinition Version="6.1" Uri="tcd:cartridge:example" Description="Example cartridge."
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_ambient_cartridge_conf.xsd">
<ClaimDefinitions>
<ClaimDefinition Uri="tcd:claim:userid" Scope="SESSION" Description="The user's unique identifier." />
<ClaimDefinition Uri="tcd:claim:username" Scope="SESSION" Description="The user's full name." />
<ClaimDefinition Uri="tcd:claim:usersex" Scope="SESSION" Description="The user's sex (M or F)." />
<ClaimDefinition Uri="tcd:claim:userage" Scope="SESSION" Description="The user's age in years." />
</ClaimDefinitions>
<ClaimProcessorDefinitions>
<ClaimProcessorDefinition Uri="tcd:claimprocessor:example:userdetails" ImplementationClass="com.tridion.ambientdata.processing.ExampleClaimProcessor1"
Description="Example claim processor that gets user details.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="tcd:claim:userid" />
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="tcd:claim:username" />
<ClaimDefinition Uri="tcd:claim:usersex" />
<ClaimDefinition Uri="tcd:claim:userage" />
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
<ClaimProcessorDefinition Uri="tcd:claimprocessor:example:example2"
ConfigProviderClass="com.tridion.ambientdata.processing.ExampleClaimProcessorConfigProvider" />
</ClaimProcessorDefinitions>
</CartridgeDefinition>
Here is my cd_ambient_conf.xml file:
cd_ambient_conf.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="6.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="schemas/cd_ambient_conf.xsd">
<Cartridges>
<Cartridge File="cd_ambient_cartridge_conf.xml"/>
<Cartridge File="cd_webservice_preview_cartridge.xml"/>
<!--
-->
</Cartridges>
<!-- Cookies settings -->
<!--
<Cookies>
<CookieClaim DefaultValue="true" Name="CookieClaim"/>
<Cookie Type="Tracking" Name="myTrackingCookie" Path="/"/>
<Cookie Type="Session" Name="mySessionCookie" Path="/"/>
</Cookies>
-->
</Configuration>
And here is the debug info in my log file for Content Delivery web Service:
Debug information in cd_core.2012-11-07.log
2012-11-07 05:00:11,421 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataServiceOperation.
2012-11-07 05:00:11,437 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataWritableEntryService.
2012-11-07 05:00:11,437 DEBUG ServiceExtensionLoader - Loading extension points from config file: jar:file:/C:/Program%20Files/Tridion/CDWebservice/bin/lib/cd_preview_webservice.jar!/META-INF/services/com.tridion.webservices.extension.ODataWritableEntryService.
2012-11-07 05:00:11,452 INFO ODataWebserviceHandler - Adding OData writable entry service: WritablePageContentsEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableComponentPresentationsEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritablePageMetasEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableComponentMetasEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableKeywordsEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableBinaryContentsEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableCustomMetasEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableBinaryVariantsEntryService.
2012-11-07 05:00:11,468 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableBinaryMetasEntryService.
2012-11-07 05:00:11,468 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataWritableStreamEntryService.
2012-11-07 05:00:11,468 DEBUG ServiceExtensionLoader - Loading extension points from config file: jar:file:/C:/Program%20Files/Tridion/CDWebservice/bin/lib/cd_preview_webservice.jar!/META-INF/services/com.tridion.webservices.extension.ODataWritableStreamEntryService.
2012-11-07 05:00:11,484 INFO ODataWebserviceHandler - Adding OData writable entry service: WritableStreamBinaryContentsEntryService.
2012-11-07 05:00:11,484 INFO JAXBContextResolver - Adding default JAXB types.
2012-11-07 05:00:11,484 DEBUG ServiceExtensionLoader - Loading extension points for interface com.tridion.webservices.extension.ODataEntryRegistrationService.
2012-11-07 05:00:11,484 DEBUG ServiceExtensionLoader - Loading extension points from config file: jar:file:/C:/Program%20Files/Tridion/CDWebservice/bin/lib/cd_preview_webservice.jar!/META-INF/services/com.tridion.webservices.extension.ODataEntryRegistrationService.
2012-11-07 05:00:11,484 INFO JAXBContextResolver - Adding BinaryContents JAXB type.
2012-11-07 05:00:11,812 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2012-11-07 05:00:11,812 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext
Any help would be much appreciated. Thanks in advance.
Edit-Regarding CDA application
Error on web page
Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1
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: Com.Tridion.Ambientdata.AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1
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:
[AmbientDataException: Cannot find claim processor implementation class: com.tridion.ambientdata.processing.ExampleClaimProcessor1]
Codemesh.JuggerNET.NTypeValue.Throw(Int64 inst) +373
Codemesh.JuggerNET.JavaClass.ThrowTypedException(Int64 inst) +1364
Codemesh.JuggerNET.JavaMethod.CallObject(JavaProxy jpo, JavaMethodArguments args) +524
Com.Tridion.Ambientdata.EngineFactory.NewEngine(AmbientDataConfig ambientDataConfig) +126
Tridion.ContentDelivery.AmbientData.HttpModule.InitializeAmbientFramework() +144
Tridion.ContentDelivery.AmbientData.HttpModule.OnRequestStart(Object sender, EventArgs e) +68
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
cd_ambient_conf.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="6.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_ambient_conf.xsd">
<Cartridges>
<Cartridge File="cd_webservice_preview_cartridge.xml"/>
<Cartridge File="footprint_cartridge_conf.xml"/>
</Cartridges>
<ClaimStoreProvider>com.tridion.siteedit.preview.PreviewClaimStoreProvider</ClaimStoreProvider>
<!-- Cookies settings -->
<!--
<Cookies>
<CookieClaim DefaultValue="true" Name="CookieClaim"/>
<Cookie Type="Tracking" Name="myTrackingCookie" Path="/"/>
<Cookie Type="Session" Name="mySessionCookie" Path="/"/>
</Cookies>
-->
</Configuration>
cd_ambient_cartridge_conf.xml
<?xml version="1.0" encoding="UTF-8"?>
<CartridgeDefinition Version="6.1" Uri="tcd:cartridge:example" Description="Example cartridge."
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_ambient_cartridge_conf.xsd">
<ClaimDefinitions>
<ClaimDefinition Uri="tcd:claim:userid" Scope="SESSION" Description="The user's unique identifier." />
<ClaimDefinition Uri="tcd:claim:username" Scope="SESSION" Description="The user's full name." />
<ClaimDefinition Uri="tcd:claim:usersex" Scope="SESSION" Description="The user's sex (M or F)." />
<ClaimDefinition Uri="tcd:claim:userage" Scope="SESSION" Description="The user's age in years." />
</ClaimDefinitions>
<ClaimProcessorDefinitions>
<ClaimProcessorDefinition Uri="tcd:claimprocessor:example:userdetails" ImplementationClass="com.tridion.ambientdata.processing.ExampleClaimProcessor1"
Description="Example claim processor that gets user details.">
<RequestStart>
<InputClaims>
<ClaimDefinition Uri="tcd:claim:userid" />
</InputClaims>
<OutputClaims>
<ClaimDefinition Uri="tcd:claim:username" />
<ClaimDefinition Uri="tcd:claim:usersex" />
<ClaimDefinition Uri="tcd:claim:userage" />
</OutputClaims>
</RequestStart>
</ClaimProcessorDefinition>
<ClaimProcessorDefinition Uri="tcd:claimprocessor:example:example2"
ConfigProviderClass="com.tridion.ambientdata.processing.ExampleClaimProcessorConfigProvider" />
</ClaimProcessorDefinitions>
</CartridgeDefinition>
Error in log file
2012-11-07 14:36:31,962 WARN AmbientDataContext - There is no current ambient data context - the ambient data framework is not properly initialised
2012-11-07 14:36:31,962 DEBUG AmbientDataContext - Setting current ambient data context: com.tridion.ambientdata.web.WebContext
2012-11-07 14:36:32,071 ERROR XMLConfigurationReader - Error while validating file 'cd_ambient_conf.xml' with schema 'schemas/cd_ambient_conf.xsd'. cvc-complex-type.2.4.a: Invalid content was found starting with element 'ClaimStoreProvider'. One of '{Cookies}' is expected.
As error says , one of Cookies expected , but in documentation nowhere it is mentioned. Thanks in Advance .
NOTE- This Error comes and when I refresh page again it goes away and page works fine.I mean it comes in alternative page hit.
Please remove (or comment out) in the 'cd_ambient_conf.xml' configuration file the cartridge called:
<Cartridge File="cd_ambient_cartridge_conf.xml"/>
Note that this cartridge is just an example and should not be used in production. That cartridge contains example definitions which do not exist causing you ClassNotFoundException.
Hope this helps.
Regards,
Daniel.

Unable to browse to WCF service: HTTP 400 bad request

I have a VS2010 MVC3 solution calling 2 WCF services. Everything works fine on my first computer. I have another computer where I installed the same OS, same VS, same SQL Server Express, Same IIS, ... I copied source code of my solution on this second computer. Everything works fine when running the solution.
BUT on this second computer:
I cannot browse to the service URL !? (1)
I cannot do a "Update service reference" !? (2)
(1) When I browse to http://localhost/PLATONServices/RequestService.svc I got a HTTP400 BAD REQUEST error.
(2) I got a THE REQUEST FAILED WITH HTTP STATUS 400: BAD REQUEST METADATE CONTAINS REFERENCE THAT CANNOT BE RESOLVED: 'http://localhost/PLATONServices/RequestService.svc'.
Any idea?
Because code source is the same on both computers and everything is OK on the first computer, the problem is somewhere else. I use IIS6 on both computers but I cannot see any differences.
I searched all day long without success.
Thanks.
UPDATE
Here is the trace of WCF:
<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="Error">0</SubType>
<Level>2</Level>
<TimeCreated SystemTime="2012-05-13T08:33:37.1384484Z" />
<Source Name="System.ServiceModel" />
<Correlation ActivityID="{5d80ddb2-6cf8-4e65-bc9b-3f4b7b880605}" />
<Execution ProcessName="w3wp" ProcessID="5280" ThreadID="13" />
<Channel />
<Computer>THINKPAD</Computer>
</System>
<ApplicationData>
<TraceData>
<DataItem>
<TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error">
<TraceIdentifier>http://msdn.microsoft.com/fr-BE/library/System.ServiceModel.Diagnostics.ThrowingException.aspx</TraceIdentifier>
<Description>Throwing an exception.</Description>
<AppDomain>/LM/W3SVC/1/ROOT/PLATONServices-2-129813716146273047</AppDomain>
<Exception>
<ExceptionType>System.ServiceModel.ProtocolException, System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>There is a problem with the XML that was received from the network. See inner exception for more details.</Message>
<StackTrace>
at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>
<ExceptionString>System.ServiceModel.ProtocolException: There is a problem with the XML that was received from the network. See inner exception for more details. ---> System.Xml.XmlException: The body of the message cannot be read because it is empty.
--- End of inner exception stack trace ---</ExceptionString>
<InnerException>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
**<Message>The body of the message cannot be read because it is empty.</Message>**
<StackTrace>
at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, Action callback)
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>
<ExceptionString>**System.Xml.XmlException: The body of the message cannot be read because it is empty.**</ExceptionString>
</InnerException>
</Exception>
</TraceRecord>
</DataItem>
</TraceData>
</ApplicationData>
</E2ETraceEvent>
Make sure the service is setup within an application as outlined in this post
WCF Service returning 400 error: The body of the message cannot be read because it is empty

Resources