Tridion UI - "Bad Request" - tridion

I have installed Tridion UI 2012 folowing to the documentation and everything seems fine and I can use the UI features such as create a new page, modify an existing page and so on but everynow and then (I havenĀ“t been able to limit when or why) I receive a "Bad Request" error when clicking the "Update Preview".
The detailed error is displayed in the Event Viewer:
Log Name: Tridion
Source: Tridion Publishing
Date: 10/07/2012 12:03:37
Event ID: 100
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: ZZZZZ
Description:
Unable to update or add Binaries using OData Service.
An error occurred while processing this request.
BadRequest
Component: Tridion.SiteEdit.FastTrackPublishing
Errorcode: 1003
User: NT AUTHORITY\NETWORK SERVICE
StackTrace Information Details:
at System.Data.Services.Client.DataServiceContext.SaveResult.<HandleBatchResponse>d__1e.MoveNext()
at System.Data.Services.Client.DataServiceContext.SaveResult.HandleBatchResponse()
at System.Data.Services.Client.DataServiceContext.SaveResult.EndRequest()
at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options)
at Tridion.SiteEdit.FastTrackPublishing.ServiceImplementation.SaveBinaries(RenderedItem renderedItem, ContentDeliveryService service)
at Tridion.SiteEdit.FastTrackPublishing.ServiceImplementation.SaveBinaries(RenderedItem renderedItem, ContentDeliveryService service)
at Tridion.SiteEdit.FastTrackPublishing.ServiceImplementation.Preview(IEnumerable`1 publishedItemsInfo, TcmUri publishingTargetId)
at Tridion.SiteEdit.FastTrackPublishing.ServiceImplementation.Preview(IEnumerable`1 publishedItemsInfo, TcmUri publishingTargetId)
at SyncInvokePreview(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)
at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)
Have you seen this error before? Any ideas how to avoid/repair it?
Regards
Emma

A little late to the party, but in my case this was caused by binaries that were too big.
You can pinpoint the issue in more detail by following the steps: (Tridion 2011, SP1, HR2, but I assume this is also valid for 2013)
On the CMS server, open the TcmServiceHost.exe.config and
uncomment the body of the following tag:
<system.diagnostics><sources>
Locate the <sharedListeners> tag and create the directory that is mentioned in the initializeData attribute (or update this setting)
Restart the TcmServiceHost service and click 'Update Preview'. The logfile shows up and you can open it in the SvcTraceViewer
Find the red entry and go from there.
To allow bigger binaries (consider the performance cost!) go to your OData Session Preview Service and do the following:
Open the web.config and locate the <bindings><webHttpBinding> (the relevant binding of course, but usually this is the webHttpBinding.)
Add a binding with the following properties (inside the <webHttpBinding> element):
<binding name="AdustedBindingConfiguration" maxReceivedMessageSize="2097152000"
maxBufferSize="2097152000">
<readerQuotas maxArrayLength="81920" maxBytesPerRead="5120" maxDepth="32" maxNameTableCharCount="81920" maxStringContentLength="2097152" />
</binding>
Locate the <services><service> tag and find the relevante service ('Tridion.ContentDelivery.Webservice.ODataService' and update the bindingConfiguration attribute to match the name of the newly added binding (AdjustedBindingConfiguration in this case)
Hit 'Update Preview' again

I haven't seen exactly this one, but something similar when my Session Preview Content Delivery Endpoint URL was misconfigured.
Reading the error description I would guess your endpoint URL (the Session Preview oData service) is up and running, but it might have some other issues. I would checkout if you can manually browse that oData service and if that looks okay perhaps check out its logfiles for more details.
On IIS this typically means an issue with the correct jars and DLLs, please check the following steps for that:
For the oData website, ensure DLLs are copied from the User Interface folder \Content Delivery\roles\webservice\dotNET\webapp\x86_64.zip\bin and jars are updated from \Content Delivery\roles\webservice\dotNET\webapp\x86_64.zip\bin
For the oData website, verify if web.config nodes "bindingConfiguration" attribute are correct
For Preview website, ensure DLLs are copied from the User Interface folder \Content Delivery\roles\web\dotNET\webapp\x86_64.zip\bin and all jars are replaced with contents from the User Interface folder \Content Delivery\roles\web\dotNET\webapp\x86_64.zip\bin\lib

For me, the solution was to increase maxReceivedMessageSize to "524288000" and maxBufferSize to "524288000" in the standard web.config of the Session Preview Webservice
<webHttpBinding>
<binding name="HttpBinding" maxReceivedMessageSize="524288000" maxBufferSize="524288000">
<readerQuotas maxArrayLength="81920" maxBytesPerRead="5120" maxDepth="32" maxNameTableCharCount="81920" maxStringContentLength="2097152" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="None" />
</security>
</binding>

Related

IIS Express Crashing when Closing Developer Dialog in Brave Browser

I am using Windows 10 Pro, and am running a .NET Core 3.1 application on top of IIS Express 10.0.1741 in Visual Studio 2019, version 16.7.6.
I have created a Razor page to upload a file with the exact code from this blog:
https://www.learnrazorpages.com/razor-pages/forms/file-upload
Setup for the issue: run the program (debug or release), navigate to the page using Brave browser (normal or private), and open the file upload dialog window.
Everything is fine at this point.
When the file dialog is closed, either by selecting a file or by hitting cancel, IIS Express crashes with exit code -1.
There is an error message in the Event Log:
Log Name: Application
Source: Microsoft Security Client
Date: 11/2/2020 11:20:08 AM
Event ID: 5000
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: ****
Description:
The description for Event ID 5000 from source Microsoft Security Client cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event:
0x1
ProtectionManagement
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft Security Client" />
<EventID Qualifiers="0">5000</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2020-11-02T17:20:08.484614300Z" />
<EventRecordID>39640</EventRecordID>
<Channel>Application</Channel>
<Computer>****</Computer>
<Security />
</System>
<EventData>
<Data>0x1</Data>
<Data>ProtectionManagement</Data>
</EventData>
</Event>
But I can not figure out how to resolve this issue. I can't find logs, or dump files for IIS Express.
I have not been able to reproduce this on another Windows Server computer on the same network, with presumably the same security settings (though it is a server OS).
I have tried to sniff the packets using Fiddler, and there isn't a new HTTP packet that comes across when this happens, so it must be at a lower level on the IP stack (connection level maybe?)
I am worried about not understanding this, and it biting me again in the future.
Any ideas about what this might be?

How can I switch an existing Azure web-role from http over to https

I have a working Azure web role which I've been using over an http endpoint. I'm now trying to switch it over to https but struggling mightily with what I thought would be a simple operation. (I'll include a few tips here for future readers to address issues I've already come across).
I have created (for now) a self-signed certificate using the powershell commands documented by Microsoft here and uploaded it to the azure portal. I'm aware that 3rd parties won't be able to consume the API while it has a self-signed certificate but my plan is to use the following for local client testing before purchasing a 'proper' certificate.
ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
Tip: you need upload the .pfx file and then supply the password you used in the powershell script. Don't be confused by suggestion to create a .cer file which is for completely different purposes.
I then followed the flow documented for configuring azure cloud services here although many of these operations are now done directly through visual studio rather than by hand-editing files.
In the main 'cloud service' project under the role I wanted to modify:
I imported the newly created certificate. Tip: the design of the dialog used to add the thumbprint makes it very easy to incorrectly select the developer certificate that is already installed on your machine (by visual studio?). Click 'more options' to get to _your_ certificate and then check the displayed thumbprint matches that shown in the Azure portal in the certificates section.
Under 'endpoints' I added a new https endpoint. Tip: use the standard https port 443, NOT the 'default' port of 8080 otherwise you will get no response from your service at all
In the web.config of the service itself, I changed the endpoint binding for the service so that the name element matched the new endpoint.
I then published the cloud project to Azure (using Visual Studio).
At this point, I'm not seeing the results I expected. The service is still available on http but is not available on https. When I try to browse for it on https (includeExceptionDetailInFaults is set to true) I get:
HTTP error 404 "The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable"
I interpret this as meaning that the https endpoint is available but the service itself is bound to http rather than https despite my changes to web.config.
I have verified that the publish step really is uploading the new configuration by modifying some of the returned content. (Remember this is still available on http.)
I have tried removing the 'obsolete' http endpoint but this just results in a different error:
"Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https]"
I'm sure I must be missing something simple here. Can anyone suggest what it is or tips for further trouble-shooting? There are a number of stack-overflow answers that relate to websites and suggest that IIS settings need to be tweaked but I don't see how this applies to a web-role where I don't have direct control of the server.
Edit Following Gaurav's suggestion I repeated the process using a (self-signed) certificate for our own domain rather than cloudapp.net then tried to access the service via this domain. I still see the same results; i.e. the service is available via http but not https.
Edit2 Information from csdef file... is the double reference to "Endpoint1" suspicious?
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="HttpsEndpoint" />
<Binding name="Endpoint1" endpointName="HttpEndpoint" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="HttpsEndpoint" protocol="https" port="443" certificate="backend" />
<InputEndpoint name="HttpEndpoint" protocol="http" port="80" />
</Endpoints>
<Certificates>
<Certificate name="backend" storeLocation="LocalMachine" storeName="My" />
</Certificates>

ELMAH not displaying all error logs from SQL Server in elmah.axd

I setup Elmah to log errors to SQL Server, the web application is logging all errors to the database but not all are getting displayed in elmah.axd.
Some of the errors that are missing are:
System.Web.HttpUnhandledException
_shutDownMessage=HostingEnvironment initiated shutdown HostingEnvironment caused shutdown _shutDownStack=
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace()
at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal()....
System.Web.HttpException
Session state is not available in this context.
_shutDownMessage=IIS configuration change HostingEnvironment initiated shutdown HostingEnvironment caused shutdown CONFIG change _shutDownStack=
at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
at System.Environment.get_StackTrace() .....
See attached screenshots.
How do I make all errors in the database appear in elmah.axd?
When I was saving the error in the file system it was all fine but not when I moved to SQL Server.
Thanks!
If I may humbly build on what the chief architect Atif said, in your Web.config, it's this section:
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="foo" />
</elmah>
Set it to:
<elmah>
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="foo" applicationName="*" />
</elmah>
This will show all database error records rather than only the records that match the application name Elmah is running under. If the applicationName attribute is not provided, it's only going to return records that match the IIS assigned identifier, e.g.- "/LM/W3SVC/10/ROOT".
This is really useful if you have an application that is used purely for viewing logged Elmah errors across all applications in an environment.
I <3 Elmah!
I think it's because you have different application names (see the Application column in your screenshot) and SqlErrorLog will only display errors belonging to the application name you configured in your web.config (and in absence of one, ELMAH will default to an identifier assigned by IIS, like /LM/W3SVC/10/ROOT). This is by-design as it permits you to use one back-end database for multiple web applications. It's always best to configure a stable and logical application name. If all those errors are for the same application, you can run an UPDATE statement on the table to set the Application column to the same value.
I used sqlErrorLog, just set ApplicationName for sqlErrorLog:
Code:
var connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
var sqlErrorLog = new Elmah.SqlErrorLog(connectionString);
var controller = executedContext.Controller as Controller;
if (controller != null)
sqlErrorLog.ApplicationName = controller.Request.ServerVariables["APPL_MD_PATH"];
var errorId = sqlErrorLog.Log(error);
result image:

WCF - More than one endpoint configuration for that contract was found - Error

We have working ASP.Net web application with WCF. wcf service hosted as a windows service. All is fine. Then we made a change so that service contract will have different namespace (From Namespace1.IserviceContract to Namespace2.IserviceContract). After the change we deployed to the server and getting following error when we try to instantiate the service object.
System.InvalidOperationException: An endpoint configuration section for contract 'Namespace2.IserviceContract' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
Generated: Fri, 06 Jul 2012 21:02:56 GMT
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.InvalidOperationException: An endpoint configuration section for contract 'Namespace2.IserviceContract' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
at System.ServiceModel.ClientBase`1..ctor()
at TestApplication.ManagementWrapper.VerifyAuthentication(Int32 appId, String Token)
at TestApplication.VerifyAuthentication(String tokenstring)
we did a research about this issue and found that this type if exception shows up if we have two client endpoints defined in our web.config file. however we are certain that we have only one client endpoint defined. More over this exception shows up only in the server. local works fine. here is our service model:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_Management" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="4194304" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="32768" maxNameTableCharCount="2147483647" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None" />
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://servername:9010/Management/service/ManagementService" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_Management" contract="Namespace2.IserviceContract" name="NetTcpBinding_IserviceContract" />
</client>
</system.serviceModel>
we also tried to restart IIS and application pool. Still getting the same exception.
Try searching your web.config for another that is using the web address as your ManagementService. Also, search the web.config for any reference to the old namespace (contract="Namespace1.IserviceContract"). Don't forget to check for extra .config files. That little gotcha has burned me before.
Whatever protocol is being called like basic, net.tcp or wshttp, that address should be in web config file remove other addresses from client section in app.config file, in my case i am calling the service as htp://machinename:700/test.svc but in the client section there were addresses with net.tcp and wshttp configurations, removed those addresses and issue is fixed for me.
Please right click on svc file of your wcf service and click on View markup.
then modify namespace there also. It should work fine then.
If everything in your web.config appears to be correct, this error can be caused by another application on the same server. I spent several days troubleshooting a similar issue.
In my case, the environment had a large number of WCF services deployed as web applications in IIS under a single website as follows.
/Root Website
/Service1
/Service2
/Service3
/ServiceX
One of the child services was mistakenly deployed to the root website physical folder rather than to it's own physical folder. This bad deployment contained a client endpoint definition that was common to all of the services and caused all of the child services to break. Apparently, the same client endpoint cannot be used by the parent website and a child web application.
Removing the client endpoint from the root website fixed the issue for me.

I set up my SDL Tridion 2011 instance to run with multiple host headers and now the Core Service doesn't work. How do I fix it?

I recently configured my SDL Tridion 2011 CME to use multiple host headers. To enable the CME to load I set WCF.RedirectTo in the appropriate web.config. However, my Core Service no longer works. I get the following error:
WebHost failed to process a request.
Sender Information: System.ServiceModel.ServiceHostingEnvironment+HostingManager/63835064
Exception: System.ServiceModel.ServiceActivationException: The service '/webservices/CoreService.svc' cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item. ---> System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
How do I fix this?
You can enabled the multiple site bindings by editing the web.config for the Tridion UI and the Core Service:
Open the web.config in [Tridion Install Folder]\web\WebUI\WebRoot\
Find the serviceHostingEnvironment section Add a new attribute to that node for multipleSiteBindingsEnabled="true"
This should then look like <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
Save the file
Open the web.config in [Tridion Install Folder]\webservices\
Find the serviceHostingEnvironment section
Add a new attribute to that node for multipleSiteBindingsEnabled="true" This should then look like <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true">
Save the file
If you don't want to enable it for all URL's you can enable it for specific ones like:
<system.serviceModel>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://test1.tridion.com"/>
<add prefix="http://test2.tridion.com"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>

Resources