Print Page | Close Window

Connecting to winforms

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3009
Printed Date: 28-Mar-2024 at 7:18am


Topic: Connecting to winforms
Posted By: Testing
Subject: Connecting to winforms
Date Posted: 13-Oct-2011 at 3:15am
Hi,

I'm testing this a little bit further, and I'm trying to do a new thing.. Ria..
I haven't created a service before.

The service is up and running. But when I'm connecting to this in my winforms app, it shows following error:
The HTML document does not contain Web service discovery information.
Metadata contains a reference that cannot be resolved: 'http://localhost:9009/EntityService.svc'.
Content Type application/soap+xml; charset=utf-8 was not supported by service http://localhost:9009/EntityService.svc.  The client and service bindings may be mismatched.

Now, in normal ria services you can change it by <services> and <behaviors>, but there is no documentation (for this error) that is specific for Ideablade.

I've tried some bindingchanges, but none of them seem to work..
My added items in the config files:
<objectServer serviceName="testIdeablade" remoteBaseURL="http://localhost" serverPort="9009" useDCS="true">
    <clientSettings isDistributed="false" />
      <serviceKeys>
        <serviceKey name="BOS2" remoteBaseURL="http://localhost" serverPort="80" serviceName="EntityService.svc" />
      </serviceKeys>
    <serverSettings allowAnonymousLogin="true" supportedClientApplicationType="WinClient" loginManagerRequired="false" useAspNetSecurityServices="false" userSessionTimeout="30" sessionEncryptionKey=""/>
</objectServer>


Thank you!



Replies:
Posted By: DenisK
Date Posted: 13-Oct-2011 at 4:27pm
Hi Testing;

I'm still unclear in what you're trying to accomplish. It sounds like you're configuring your own raw WCF service when you shouldn't have to. Are you trying to do an n-tier WinForms application? Do you already have a Web project setup in your solution? If so, is it possible to see your full app.config and web.config?


Posted By: Testing
Date Posted: 13-Oct-2011 at 11:48pm
Hi,

Thank you for your quick answer.

Yes, I'm configuring a WCF Service.. just to create an n-Tier Winforms Application (But I must also be possible to connect to it from a Silverlight or ASP.NET application). And the service needs to be on his own.. There will be later several other projects that will connect to that Service. In another solution. 

So my web.config right now is : 
<ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig">
    <logging logFile="log\DebugLog.xml" />
    <!-- Additional configuration can be added to override defaults. 
         See the sample config files in the Learning Resources for more information.
    -->
    <objectServer serviceName="testIdeablade" remoteBaseURL="http://localhost" serverPort="9009" useDCS="true">
      <clientSettings isDistributed="false" />
      <serviceKeys>
        <serviceKey name="BOS2" remoteBaseURL="http://localhost" serverPort="80" serviceName="EntityService.svc" />
      </serviceKeys>
      <serverSettings allowAnonymousLogin="true" supportedClientApplicationType="Both" loginManagerRequired="false" useAspNetSecurityServices="false" userSessionTimeout="30" sessionEncryptionKey=""/>
    </objectServer>
  </ideablade.configuration>
  <system.serviceModel>
    <!-- Set aspNetCompatibilityEnabled to true to allow use of ASP.NET security features. 
         Set multipleSiteBindingsEnabled to true for Azure or if your web site has multiple http bindings.
    -->
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />
    <!-- You can add Service definitions to override the default configuration. 
         See the sample config files in the Learning Resources for more information.
    -->
    
  </system.serviceModel>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </assemblies>
    </compilation>
  </system.web>
</configuration>


and my app.config hasn't changed yet.. I couldn't add a servicereference.

Am I doing this completely wrong? And how is a better way to implement this? Is there a way I can find more documentation about n-tier DevForce Winforms Applications?
I just followed this :  http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-client-servicemodel - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-custom-client-servicemodel

Thank you 



Posted By: DenisK
Date Posted: 14-Oct-2011 at 4:58pm
Hi Testing;

If I understand correctly, you want to be able to create 1 WCF service and let that service be consumed by a WinForm application, Silverlight or ASP.NET application.

You can actually do this by creating 1 web project and share that project with the different solution.

You mentioned that your service is up and running. How are you deploying your app? Is it through IIS? What is the address of your EntityService.svc?

Here are a sample of app.config and web.config in a WinForm n-tier application. This is taken from the DevForce N-Tier WinForm Application Template.  http://drc.ideablade.com/xwiki/bin/view/Documentation/start-devforce-template-inventory - http://drc.ideablade.com/xwiki/bin/view/Documentation/start-devforce-template-inventory

As you'll see, the default config files are pretty simple. You shouldn't need all those custom config if you're just starting out.

App.Config

<configuration>
  <configSections>
    <section name="ideablade.configuration" type="IdeaBlade.Core.Configuration.IdeaBladeSection, IdeaBlade.Core"/>
  </configSections>

  <ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig">

    <logging logFile="DebugLog.xml"/>

    <objectServer remoteBaseURL="http://localhost" serverPort="9009" serviceName="EntityService.svc" >
      <clientSettings isDistributed="true" />
    </objectServer>

    <!-- Additional configuration can be added to override defaults. 
         See the sample config files in the Learning Resources for more information.
    -->

  </ideablade.configuration>

</configuration>

Web.Config

<configuration>
  <configSections>
    <section name="ideablade.configuration" type="IdeaBlade.Core.Configuration.IdeaBladeSection, IdeaBlade.Core" />
  </configSections>

  <connectionStrings>
    <!-- Remember to add your connection string(s) here -->
  </connectionStrings>


  <ideablade.configuration version="6.00" xmlns="http://schemas.ideablade.com/2010/IdeaBladeConfig">

    <logging logFile="log\DebugLog.xml" />

    <!-- Additional configuration can be added to override defaults. 
         See the sample config files in the Learning Resources for more information.
    -->

  </ideablade.configuration>

  <system.serviceModel>

    <!-- Set aspNetCompatibilityEnabled to true to allow use of ASP.NET security features. 
         Set multipleSiteBindingsEnabled to true for Azure or if your web site has multiple http bindings.
    -->
    <serviceHostingEnvironment aspNetCompatibilityEnabled="false" multipleSiteBindingsEnabled="true" />

    <!-- You can add Service definitions to override the default configuration. 
         See the sample config files in the Learning Resources for more information.
    -->
  </system.serviceModel>

  <system.web>
    <compilation debug="true" targetFramework="4.0"><assemblies><add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /></assemblies></compilation>
  </system.web>

</configuration>



Posted By: Testing
Date Posted: 18-Oct-2011 at 5:04am

If I understand correctly, you want to be able to create 1 WCF service and let that service be consumed by a WinForm application, Silverlight or ASP.NET application.
-> Yes, that is right!

You can actually do this by creating 1 web project and share that project with the different solution.
-> That's what I'm doing right now.

You mentioned that your service is up and running. How are you deploying your app? Is it through IIS? What is the address of your EntityService.svc?
-> My service is running inside Visual Studio with the web development server. The address is now http://localhost:9009/EntityService.svc

As you'll see, the default config files are pretty simple. You shouldn't need all those custom config if you're just starting out.
-> Yes, I see.. I tried it out with your web.config and app.config.. And the service is also running(like magic)..

But, you if i'm understanding correctly.. You never need to do > Right click on project > add service reference > go to svc url and add it that way. The only thing you need to do is adding following lines to your app.config & adding a dll reference of your webservice?..
    <objectServer remoteBaseURL="http://localhost" serverPort="9009" serviceName="EntityService.svc" >
      <clientSettings isDistributed="true" />
    </objectServer>
& if so: How do i get the servicename property if I'm creating a new webservice?

Thank you!


Posted By: DenisK
Date Posted: 19-Oct-2011 at 12:13pm
Yes, that's correct. You never need to add an svc url or a dll ref to the webservice. The app.config and web.config are where you place the EntityService URL.

if so: How do i get the servicename property if I'm creating a new webservice?

Hmm, I'm not sure why you need to get the serviceName property. In DevForce, the serviceName will always be EntityService.svc.

If you haven't already done so, you might want to try reading  http://drc.ideablade.com/xwiki/bin/view/Documentation/configure-deploy - http://drc.ideablade.com/xwiki/bin/view/Documentation/configure-deploy

It's also useful to start a project from one of our DevForce templates. The app.config and web.config are already set in those templates so in most cases, they're a good starting point to learn about the config files. 


Posted By: Testing
Date Posted: 20-Oct-2011 at 5:04am
If it is always EntityService.svc there is no problem..

All right, I was thinking too far.. I'm sorry for this issue..
But the documentation is most of the time about deploying, but not about actual programming between client, server..
Maybe a tip: It could be handy to add a Tour of DevForce Ria Services, created like Tour of DevForce Silverlight or WPF.. I think there are many beginner user that have the same problem.

Just last question..
If i want to connect to the DevForce server by Client.. I just add a link from the Server Ideablade Designer file to my client project(like in the tour of Silverlight)? If not, please give me some sample code that connects to the server and get some basic data (just to understand the principles)

& sorry for my English.. English is not my first language (which you have seen already)..

Thank you!




Posted By: DenisK
Date Posted: 21-Oct-2011 at 10:56am
Thank you for your feedback. We actually do have a sample that shows how to program between client and server. It's in WPF but the concept still applies to WinForms.  http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-hello-devForce - http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-hello-devForce

The linking of the designer file in Silverlight is because Silverlight and .NET don't share the same supporting libraries. See  http://drc.ideablade.com/xwiki/bin/view/Documentation/model-link-source-file - http://drc.ideablade.com/xwiki/bin/view/Documentation/model-link-source-file  for more details.

As you'll see from the code sample, to connect to the server, you just need to set your app.config and web.config. This short documentation should also give you an overview on how DevFroce handles WCF configuration.  http://drc.ideablade.com/xwiki/bin/view/Documentation/WCF - http://drc.ideablade.com/xwiki/bin/view/Documentation/WCF

No worries on your English, you're doing just fine :) Good luck!


Posted By: Testing
Date Posted: 04-Nov-2011 at 1:37am
Sorry for the late answer.. 
But everything is working fine!

Thank your for the support!



Print Page | Close Window