.NET

Reply
Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 11 of 19 (270 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-16-2013 06:11 AM in reply to: 110000474593

Made some modifications to your service class: added a helper class clsFindTag that inherits from Control.  This seems to be working. Let me know if you have questions.

New Member
nirmalya23
Posts: 1
Registered: ‎07-16-2013
Message 12 of 19 (262 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-16-2013 06:55 AM in reply to: 110000474593

Hi, You must solve the multithreading issues to get out of this type of errors.

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 13 of 19 (252 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-16-2013 08:06 AM in reply to: 110000474593

If you can get it working using WinForms Control.BeginInvoke() then no problem. I prefer WPF myself. It's totally fine to mix both technologies by adding the WPF references.





Fenton Webb

Developer Technical Services

Autodesk Developer Network


Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 14 of 19 (248 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-16-2013 08:33 AM in reply to: 110000474593

I concur.

 

If you replace in my previous attachment clsFindTag with wpfFindTag bellow, it works the same.  You have to inherit from UserControl however!

 

    public class wpfFindTag : UserControl
    {
        public Editor ed = null;
        public void PrintMessage(String msg)
        {
            Action action = () =>
            {
                ed.WriteMessage("Hello, this is FindTag : IFindTag={0}", msg);
            };
            Dispatcher.CurrentDispatcher.BeginInvoke(action);
        }
    }

Active Contributor
110000474593
Posts: 29
Registered: ‎09-24-2012
Message 15 of 19 (229 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-17-2013 12:24 AM in reply to: sszabo
Hi sszabo,

Thank you so much for your help, it is working now!! However, I still get some time-out and connection errors (TCP error code 10061) sometimes. Mabye I have to change some settings in my firewall and ports? And it takes about 20 seconds before my text appears in the editor. Is your WCF service working fast?

Fenton, you also thanks for your help!
Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 16 of 19 (221 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-17-2013 04:52 AM in reply to: 110000474593

20 seconds?! that doesn't sound right.  Are you getting this timeout while running your client on the same machine as server or from a remote machine, is it working on the same machine? can you post the exceptions you are getting?!  I am on AutoCAD 2013 and it works fine for me running on the same machine whith the code I attached above and I used both WCFTestClient and your client to confirm this.

 

I see this code in your client that obviously will not work anywhere except on one machine:

EndpointAddress ep = new EndpointAddress("net.tcp://192.168.1.42:8025/ACADWCF.Services/FindTag/");

 

Also, if it works on 1 machine and it doesn't work on another chances are it's because of a default web config file.  You should really have a <system.serviceModel> section in your app.config that you obtain from running:

C:\svcutil /language:cs  /out:ACADWCFProxy.cs /config:ACADWCF.exe.config net.tcp://192.168.1.42:8025/ACADWCF.Services/FindTag

 

Also, if any of the posts in this thread contain the solution can you please mark it as response, thanks.

Active Contributor
110000474593
Posts: 29
Registered: ‎09-24-2012
Message 17 of 19 (191 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-19-2013 12:07 AM in reply to: sszabo

Yes, I'm running my client on the same machine as the service. I changed the IP adress in my endpointAddress to '(localhost)', so that should be working.

Is the web config file created by visual studio automatically? If yes, which one is it? If have af file called 'ACADWCF.Services.dll.config' in my ACADWCF debug directory. I've attached this file.

I'm not familiar with command you mention. Where should I run the command you mention in your post?

Valued Contributor
sszabo
Posts: 86
Registered: ‎09-05-2012
Message 18 of 19 (182 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-19-2013 05:31 AM in reply to: 110000474593

Yes, I'm running my client on the same machine as the service. I changed the IP adress in my endpointAddress to '(localhost)', so that should be working.

 

use 127.0.0.1 everywhere just to be sure.

If have af file called 'ACADWCF.Services.dll.config' in my ACADWCF debug directory. I've attached this file.

 

There are several problems with the config file you sent me.  First of all it's using the wrong protocol (http) your service is net.tcp.  Too many issues to list them all.  Remove this file and replace it with svcutil output.  Alternatively just replace the whole system.serviceModel section in this file with the following:

 

    <system.serviceModel>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_IFindTag" 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="524288" maxBufferSize="65536" maxConnections="10"
                    maxReceivedMessageSize="65536">
                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                    <reliableSession ordered="true" inactivityTimeout="00:10:00"
                        enabled="false" />
                    <security mode="None">
                        <transport clientCredentialType="Windows" protectionLevel="EncryptAndSign" />
                        <message clientCredentialType="Windows" />
                    </security>
                </binding>
            </netTcpBinding>
        </bindings>
        <client>
            <endpoint address="net.tcp://192.168.1.42:8025/ACADWCF.Services/FindTag/"
                binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IFindTag"
                contract="IFindTag" name="NetTcpBinding_IFindTag" />
        </client>
    </system.serviceModel>

Make sure the IP address matches your machine and this was created with the service version I attached in my response above!


I'm not familiar with command you mention. Where should I run the command you mention in your post?

 

To find this tool on your system type in where svcutil in Visual Studio Command Prompt. On my system it's:

C:\Program Files (x86)\Microsoft Visual Studio 11.0>where svcutil
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\SvcUtil.exe


It is crucial that you read the basics on svcutil and WCFTestClient if you are planning on dealing with WCF in the future: it will save you a lot of headache. Google both of these, I can't send you MSDN links, these pages are down for some reason but it used to be here:

http://msdn.microsoft.com/en-us/library/aa347733.aspx

If MDSN still down try this:

http://www.svcutil.com/

 

Please give kudos if an advice helped to solve a specific problem (one solution is plenty for 1 thread), thanks!

Active Contributor
110000474593
Posts: 29
Registered: ‎09-24-2012
Message 19 of 19 (166 Views)

Re: WCF and Autocad P&ID, eNotApplicable error

07-22-2013 12:13 AM in reply to: sszabo

Thank you very much sszabo. This week I'm going to try it with the config file you send me. I also will read about svcutil and WCFTestClient. I'll will let you know if it all works fine.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community