Patrick's Bytes

28, July 2008

Workflow Services error: "Operation is not implemented by the service"

Filed under: WCF,Windows Workflow Foundation — patrickyong @ 2:55 am

I been trying to solve this Workflow Services error on my IssueTracker project for 2 weeks without any progress. 😦

Operation is not implemented by the service.
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)\r\n   at

System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)\r\n   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)\r\n   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)\r\n   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)\r\n\r\nException rethrown at [0]: \r\n   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)\r\n   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)\r\n   at IssueTrackerTest.IssueProcessService.IIssueProcess.ProcessIssue(Issue issue)\r\n   at IssueTrackerTest.IssueProcessService.IssueProcessClient.ProcessIssue(Issue issue) in C:\\Workspace\\Projects\\IssueTracker\\IssueTrackerTest\\Service References\\IssueProcessService\\Reference.cs:line 285\r\n   at IssueTrackerTest.IssueProcessTest.TestProcessIssue() in C:\\Workspace\\Projects\\IssueTracker\\IssueTrackerTest\\IssueProcessTest.cs:line 88″    string

 

Until today I found this blog post by Damir Dobric.

While invoking an operation on the workflow’s web service you may get following error:

“Operation is not implemented by the service.”

To solve the problem take a look on the ContextToken property of the receive-activity of the workflow service.
If this property is set as shown on the picture below, remove the value, rebuild solution and start all again.

image

 

Thanks Damir for saving my days 🙂

2, July 2008

Passing large files over WCF channel

Filed under: WCF — patrickyong @ 10:32 am

If you want to pass large binary files via a WCF channel, you need to increase the maxStringContentLength on your WCF host app.config/web.config file. From my sample on my IssueTracker project, I added a new bindings element to the system.serviceModel section as below:
        <bindings>
            <wsHttpBinding>
                <binding name=”WSHttpBinding_IDataService” closeTimeout=”00:01:00″
                    openTimeout=”00:01:00″ receiveTimeout=”00:10:00″ sendTimeout=”00:01:00″
                    bypassProxyOnLocal=”false” transactionFlow=”false” hostNameComparisonMode=”StrongWildcard”
                    maxBufferPoolSize=”2147483647″ maxReceivedMessageSize=”2147483647″
                    messageEncoding=”Text” textEncoding=”utf-8″ useDefaultWebProxy=”true”
                    allowCookies=”false”>
                    <readerQuotas maxDepth=”2147483647″ maxStringContentLength=”2147483647″ maxArrayLength=”2147483647″
                        maxBytesPerRead=”2147483647″ maxNameTableCharCount=”2147483647″ />
                    <reliableSession ordered=”true” inactivityTimeout=”00:10:00″
                        enabled=”false” />
                    <security mode=”Message”>
                        <transport clientCredentialType=”Windows” proxyCredentialType=”None”
                            realm=”” />
                        <message clientCredentialType=”Windows” negotiateServiceCredential=”true”
                            algorithmSuite=”Default” establishSecurityContext=”true” />
                    </security>
                </binding>
            </wsHttpBinding>
        </bindings>

        Having done that, your service will still not using this binding configuration, you need to add the binding name to the bindingConfiguration attribute inside your service element.

  <services>
      <service behaviorConfiguration=”DataServiceBehavior” name=”Zuko.Service.DataService”>
        <endpoint address=”” binding=”wsHttpBinding” contract=”Zuko.Service.IDataService” bindingConfiguration=”WSHttpBinding_IDataService”>
          <identity>
            <dns value=”localhost” />
          </identity>
        </endpoint>
        <endpoint address=”mex” binding=”mexHttpBinding” contract=”IMetadataExchange” />
      </service>
    </services>

1, July 2008

Microsoft Open Specification v1.0 released

Filed under: .NET Programming,Exchange,Office,Sharepoint,SQL Server,WCF,WPF — patrickyong @ 8:49 am

Awhile ago I blogged about Microsoft releasing products protocol documentation which are essential design specifications. That was about 2 months ago and the documents are of beta version.

Today the official version 1 is out that it covers the following products.

  1. Windows
  2. WCF
  3. Windows Server Protocol
  4. .NET Framework
  5. Office
  6. Office Binary File Format
  7. SharePoint
  8. Exchange
  9. SQL Server
  10. VBA Language Spec
  11. XAML

WCF Unit Test timeout issue

Filed under: WCF — patrickyong @ 12:16 am

image

I am creating some Unit Test for my IssueTracker project. My unit test class will connect to a WCF service and execute command. Whenever I start testing the code, after awhile the test just hang there until timeout and returns the follow message.

Failed    TestAddIssueAttachment    IssueTrackerTest    Assert.Fail failed. The request channel timed out while waiting for a reply after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.   

I am suspecting something is not right with my code. So I start searching the web, and I came across the following post by fellow MVP Benjamin Day. He had the same issue and realized actually he forgot to close the proxy connection. Yup, WCF proxy has to be closed, refer the unit test code sample below

                        [TestMethod]
        public void TestDeleteIssueAttachment()
        {
            IssueTrackerService.IssueTrackerServiceClient client
                = new IssueTrackerService.IssueTrackerServiceClient();

            try
            {

                client.Open();

                list = client.ListIssueAttachments().ToList();

                …..

            } finally {

                 client.Close();

            }

         }

17, January 2008

VSTO Reloaded

Today the MSE team did a Tech Preview to fellow developers on Visual Studio 2008 which actually available for MSDN subscribers late last year and is available for sales now.

My session is about Visual Studio Tools for Office (VSTO) 2008 and a lot of productivity enhancements have been put inside the package in this current version. They include but not limited to:

  1. Better UI Development on Office UI
    • Form Regions in Outlook
    • Custom Task Pane
    • Custom Ribbon for Excel, Word and PowerPoint.
    • No relearn, leverage on Windows Form Development skill
    • Windows Form able to host WPF app and extends this capability via Custom Task Pane
  2. SharePoint Workflow development
    • No more manual writing of workflow.xml, feature.xml (both are SharePoint feature config files) and deployment script
    • Streamline development process from 15 steps to 3 steps in VSTO 2008
  3. Word Content Control data binding with VSTO addin
    • Bringing unstructured data from Word documents to a structured world
    • Able to attach custom XML such as RosettaNet or UNeDoc which as industry based XML schema to Word data.
  4. Easy deployment of VSTO – Office Addin via Click Once
    • No more reliant on CASPOL
    • Transparent to end users

vstodemo

I demo a cool VSTO addin for Word 2007 hosting a WPF user control with colossal effect and acting as a client to a WCF services at the back end. The data access is done using LINQ for XML. After that I will publish

It is based on an article in MSDN Dec 2007 issue but the source codes there is not working for RTM version of VS 2008. Many thanks for fellow MS staff Andrew Whitechapel for making it work for VS2008 RTM.

You can download the slides and working version of the source code here. They are hosted on Windows Live Skiydrive/ Folders.

Slides in PDF

Slides in XPS

Source Code in C#

I will come out with a tutorial for the SharePoint Workflow later and also a VB9 version of the source code. So stay tuned. 🙂

Blog at WordPress.com.