.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

MTOM throws ServiceModel.ProtocolException

Posted By:      Posted Date: October 02, 2010    Points: 0   Category :WCF

For some reason Mtom is not working in my WCF service. I have changed both .config (server and client) to use Mtom on one of the endpoint. When I try to do anything on the service, I get the following error.

Content Type multipart/related; type="application/xop+xml";start="<http://tempuri.org/0>";boundary="uuid:4ef93280-dcd5-4795-9b4a-9db29d4baa75+id=1";start-info="text/xml" was not supported by service http://localhost/WCFapp2/Service1.svc/str.  The client and service bindings may be mismatched.

I am hosting my service with IIS 7.5

One thing I have just discovered is that if I have the client set to Text encoding then it will work even if the service is configured to use Mtom. It's like the IIS service doen't even detect that I have changed the config file even though I made sure it saved and started/stopped and recycled the App Pool plenty of times.

I can post my config files if that would help.


View Complete Post

More Related Resource Links

userprincipal.changepassword throws exception


Hi all,

      userprincipal.changepassword(oldpassword, newpassword);

gives error: that is Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied. (Exception from HRESULT: 0x80070547)

but userDirectoryEntry.invoke("ChangePassword", new object[] { oldpassword, newpassword });

      userDirectoryEntry.CommitChanges works fine.

Any one please tell me the reason behind this.

WebControls.TableRow throws exception on Add()


I have the following method to strip hidden and user-specified columns from a gridviewrow and return a tablerow. 

    Private Shared Function StripHiddenColumns(ByVal gvRow As GridViewRow, ByVal ColumnsToExclude() As Integer) As TableRow

        Dim row As New TableRow
        Dim i As Integer = 0
            For Each cell As TableCell In gvRow.Cells
                If cell.Visible Then
                    If Not ColumnsToExclude.Contains(i) Then
                    End If
                End If
                i += 1

            Return row
        Catch ex As Exception
            Throw ex
        End Try
    End Function

However, when I run this code and hit the Add method for the TableRow,  I get an InvalidOperationException stating the Collection was modified; enumeration operation may not execute.  I've gotten this exception before, but usually it's because I'm attempting to modify a table that is databound.  This particular one is not, i am creating it.  Can anyone offer any insight? 

Thanks in advance.


ScriptResource.axd throws ArgumentOutOfRangeException


I've done a lot of research on this error and I can't seem to figure it out:


Specified argument was out of the range of valid values.
Parameter name: utcDate

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.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: utcDate

Source Error: 

Security trimmed URL throws an error if not logged in

On a Moss 2007 site, using FBA - I have an issue with security trimmed items within Lists.   There is not a problem with direct url links to non-list items.  
For list items - here is the problem, when a user is not logged in and follows a direct url link from an email or newsletter to security trimmed items within a list - it throws an error instead of offering a redirect to login?

More info:  This is only occurring for individually security trimmed list items that have had anonymous access removed.  When a whole list or library has had anonymous removed, the links work fine (login page appears, log in, taken to original link).

Why is that and is there a way to avoid the error?

If it is of help, this is the error. Thanks in advance.

Object reference not set to an instance of an object.

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.NullReferenceException: Object reference not
set to an insta

SPWorkflowManager.CancelWorkflow throws an exception


Sorry, I had posted that same question in the "Dev and Programming" forum, but I'm reposting here because it's more of a workflow related question.

We are trying to cancel workflow programmatically.

It used to work fine until we migrated our environment to a new server and now it fails.

Our code goes something like this: 


foreach (SPWorkflow wf in form.Workflows)


//code omitted for brievety



But an ArgumentException is thrown.

Msdn docs say that an ArgumentNullException exception can be thrown (ArgumentNullException: The workflow to cancel belongs to an SPWeb object that has been deleted) but it is actually an ArgumentException that is thrown. Plus I know for sure that the SPWeb does not get deleted.

I tried to reflector what piec

Remoting from WebService throws: An existing connection was forcibly closed by the remote host

Hello everyone, I have a problem with using .NET remoting from webservice. When using remoting from console application, there is no problem. I suppose problem is somewhere in IIS. My system is Windows Vista. Thank you for any help. Best regards, Jozef

System.ServiceModel.ServiceActivationException was unhandled

I've got a very, very simple WCF service. I'm hosting on Windows 08 with IIS7. The site is setup as such: E:\inetpub\wwwroot\WCFServices\FService --- permissions are good The contents of the FService is: 1. \bin -- an assembly 2. FService.svc -- <%@ServiceHost language="c#"  Debug="true"  Service="Company.Unit.Section.FService" %> 3. web.config -- <?xml version="1.0" encoding="utf-8"?> <configuration>   <connectionStrings>     <add name="fConnectionString" connectionString="Data Source=servername,25654;Initial Catalog=dbname;Persist Security Info=True;User ID=user;Password=password" providerName="System.Data.SqlClient" />   </connectionStrings>   <system.serviceModel>          <bindings>           <wsHttpBinding>               <binding name="WSHttpBinding_IFService" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="

ssrs 2008 R2 - report parameter with no default set throws java script error

We have recently upgraded from SQL Server 2008 to SQL Server 2008 R2....I am experiencing a problem with my report parameters on my SSRS reports. It seems that my report parameters that I do not have a specified 'default' value throws a java script error when I try and run/render the report under R2.  As soon as I put a 'default' value on the report param, everything is fine.  However, that is not the behavior we need for our reports...the user needs to pick their selection. Can anyone shed some light on this, it seems to be an AJAX problem...I need to be able to have report parameters with a list of values, but no 'default' value on the parameter.

Master-Detail GridView in Single Page example with paging throws error

___http://www.java2s.com/Code/ASP/Data-Binding/MasterDetailGridViewinSinglePage.htmI followed example at the link above.When I enablind paging=true (by pagesize=3).and clicking to pages 2|3|4 etc and so;error occuringIndex was out of range. Must be non-negative and less than the size of the collection.at cs line :sourceProducts.SelectParameters[0].DefaultValue = gridMaster.DataKeys[e.Row.DataItemIndex].Value.ToString();got any idea?what should I make to fix this ? is this error  fixable ?thanks much.

System.ServiceModel.Activation.WebScriptServiceHostFactory (using this how can i increase the maxrec

using the System.ServiceModel.Activation.WebScriptServiceHostFactory (which does not need configuration) how can i increase the maxreceived message size ? can i do this in code behind???

Problem with DuplexChannelFactory(System.ServiceModel.InstanceContext, System.ServiceModel.Descripti

I have derived a class from DuplexChannelFactory, and one of the constructors of the derived class takes System.ServiceModel.InstanceContext and System.ServiceModel.Description.ServiceEndpoint arguments. I simply pass them down to the base DuplexChannelFactory class, e.g.: public DerivedDuplexChannelFactory(System.ServiceModel.InstanceContext instanceContext, System.ServiceModel.Description.ServiceEndpoint endPoint) : base(instanceContext, endPoint) {} The problem I am running into that I get timeout exceptions when trying to callback the client during a service call, e.g.: Client subscribes to Service Client calls some Service method, during which call the Service will callback to the client Before I go further, if I call down to a different base constructor of DuplexChannelFactory, things work perfectly, e.g.: public DerivedDuplexChannelFactory(System.ServiceModel.InstanceContext instanceContext, System.ServiceModel.Description.ServiceEndpoint endPoint) : base(instanceContext, endPoint.Binding, endPoint.Address) {} If I use the former, I get the following exception: "This request operation sent to http://schemas.microsoft.com/2005/12/ServiceModel/Addressing/Anonymous did not receive a reply within the configured timeout (00:00:59.9820000). The time allotted to this operation may have been a portion of a longer timeout. This may be because the service is still pr

Process.MainModule on x64 platform throws Win32Exception: "Only part of a ReadProcessMemory or Write

This is a very odd issue and I think it should be a bug of .Net framework. the code is like below: class Program { static void Main(string[] args) { try { Process[] procs = Process.GetProcessesByName("abc"); if(procs == null || procs.Length < 1) return; Process proc = procs[0]; Console.WriteLine("Got it: " + proc.MainModule.ModuleName); } catch (Exception ex) { Console.WriteLine("Failed to get process: {0}", ex); } Console.Read(); } } the "abc.exe" is another program compiled with "For Any CPU", and the testing operating system is Windows 2003 x64 When the code is compiled with "x64" or "For Any CPU", it works very well. but, if I change the compiling configuration to "x86", it will throw out a Win32Exception "Only part of a ReadProcessMemory or WriteProcessMemory request was completed" stack trace:    at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly)    at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId)    at System.Diagnostics.Process.get_MainModule()    at KillProcessTest.Program.Main(String[] args) in D:\Users\rsp\KillProcessTest\KillProcessTest\Program.cs:line 18

SSRS 2008 R2 - OnPostBack from ReportParameter - if no default set, throws Value can not be null

SSRS 2008 R2 - OnPostBack from Parameter selection - if no default set, throws Value can not be null java script error. This does not happen with SSRS 2008, only with R2. and only with report parameters that do not have a 'default' set.  Any suggestions would be greatly appreciated.

EvaluateOldNewStates() throws exception when updating TreeViewItem.IsSelected

I apply a WPF theme in my application. At some point in my code, I need to change the selected tree view item. so I update the property MyViewModel.IsSelected and raise PropertyChanged event. Then I get this: Object reference not set to an instance of an object. System.Windows.StyleHelper.EvaluateOldNewStates(MultiTrigger multiTrigger, DependencyObject triggerContainer, DependencyProperty changedProperty, DependencyPropertyChangedEventArgs changedArgs, Int32 sourceChildIndex, Style style, FrameworkTemplate frameworkTemplate, Boolean& oldState, Boolean& newState) System.Windows.StyleHelper.InvokePropertyTriggerActions(TriggerBase triggerBase, DependencyObject triggerContainer, DependencyProperty changedProperty, DependencyPropertyChangedEventArgs changedArgs, Int32 sourceChildIndex, Style style, FrameworkTemplate frameworkTemplate) System.Windows.StyleHelper.OnTriggerSourcePropertyInvalidated(Style ownerStyle, FrameworkTemplate frameworkTemplate, DependencyObject container, DependencyProperty dp, DependencyPropertyChangedEventArgs changedArgs, Boolean invalidateOnlyContainer, FrugalStructList`1& triggerSourceRecordFromChildIndex, FrugalMap& propertyTriggersWithActions, Int32 sourceChildIndex) System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e) System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEve

Page navigation in a frame throws an exception

I created a very simple WPF project that exhibits the following error. I have no idea how to get of this error. System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Menu', AncestorLevel='1''. BindingExpression:Path=TemplatedParent; DataItem=null; target element is 'MenuItem' (Name=''); target property is 'CommandTarget' (type 'IInputElement') Steps to reproduce:1. Create a WPF Application project in Visual Studio 2008 (Windows 7)2. Create Page1.xaml <Page x:Class="WpfApplication1.Page1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page1"> <TextBlock> <Hyperlink NavigateUri="Page2.xaml">Page 2</Hyperlink> </TextBlock> </Page> 3. Create Page2.xaml <Page x:Class="WpfApplication1.Page2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Page2"> <TextBlock> <Hyperlink NavigateUri="Page1.xaml">Page 1</Hyperlink> </TextBlock> </Page> 4. Add a frame in Window1.xaml <Window x:Class="WpfAppli

Placing ..... configuration information in a config file other than app.config

Hi, I'm sorry if this question has been asked/answered before on this forum. I have searched both here and on the web in general, but to no avail as yet... I am running VS2010 and .Net 4, so in theory have all the latest versions of everything at my disposal. I have an executable a.exe. This downcalls into a dll b.dll. b.dll wants to send an MSMQ message using WCF. For cleanness (a.exe is a generic service and knows nothing about WCF) I want to define the client endpoint in b.dll.config. However I am finding that WCF is insisting that the information is held in a.exe.config. The exact problem is that when I create my proxy (i.e. the class which derives from ClientBase<T>), I get the message Could not find endpoint element with name 'XXX' and contract 'YYY' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this name could be found in the client element. From what I have seen I have just described an extremely common problem that people have had with WCF over the years. My questions is basically to find out, given that I have WCF 4 at my disposal, whether there is now a standard approach to this scenario? Things I have tried so far: The obvious one...putting all my config info in a.exe.config. When I do this, everything works file, so I

SSIS throws error when it doesn't find file

Hello All, I am facing one issue that i dont know in advance if there is file on FTP or not. I scheduled a job which runs every hour which in turn calling SSIS package. Now, when there is file on FTP, it works fine. But, when there is no file on FTP then itthrows error which i want to handle. Is it possible to check for any files present on FTP? Cheers, Pranav
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend