Print Page | Close Window

Devforce 6.0.4.0 and how to specify URL of EntityService

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=2083
Printed Date: 10-Jun-2026 at 5:28pm


Topic: Devforce 6.0.4.0 and how to specify URL of EntityService
Posted By: rasmus
Subject: Devforce 6.0.4.0 and how to specify URL of EntityService
Date Posted: 23-Aug-2010 at 2:52am
Hi
 
Before upgrading to Devforce 6.0.4.0, I was able to specify the URL of the EntityService programmatically in my SL app, like this:
 

IdeaBladeConfig config = IdeaBladeConfig.Instance;

config.ObjectServer.RemoteBaseUrl = "http://" + HtmlPage.Document.DocumentUri.Host;

config.ObjectServer.ServerPort = HtmlPage.Document.DocumentUri.Port;

config.ObjectServer.ServiceName = "TallyIntegratorWeb/ServicesTally/EntityService.svc";

After upgrading to 6.0.4.0 this no longer works. I have to specify the endpoint in my ServiceReferences.ClientConfig like this:
 
<configuration>

<system.serviceModel>

<client>

<endpoint name="EntityService"

address="http://localhost/TallyIntegratorWeb/ServicesTally/EntityService.svc"

binding="customBinding" bindingConfiguration="customBinaryBinding"

contract="IdeaBlade.EntityModel.IEntityServiceContractAsync"

/>

<endpoint name="EntityServer"

address="http://localhost/TallyIntegratorWeb/ServicesTally/EntityServer.svc"

binding="customBinding" bindingConfiguration="customBinaryBinding"

contract="IdeaBlade.EntityModel.IEntityServerContractAsync"

/>

</client>

<bindings>

<customBinding>

<!-- Custom binding using http, binary encoding, no security -->

<binding name="customBinaryBinding">

<binaryMessageEncoding/>

<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />

</binding>

</customBinding>

</bindings>

</system.serviceModel>

</configuration>

So now I need to alter the ServiceReferences.ClientConfig on each deployment. Can you tell me how to specify the URL of the EntityService programmatically?
 
Thak you for your help
 
Rasmus



Replies:
Posted By: kimj
Date Posted: 24-Aug-2010 at 5:38pm
Your programmatic setup of the ObjectServer element should still work in 6.0.4.  If you upgraded from DevForce 2009 check for an errant app.config file in the Silverlight application.  Also look for any custom implementation of the ServiceProxyEvents class.   Finally, make sure you do the setup before constructing the first EntityManager.


Posted By: rasmus
Date Posted: 26-Aug-2010 at 12:12pm
Hi Kim
 
Tank you for your reply. This is an upgrade from Devforce2009, the code is placed in the beginning of the silverlight app:
 

private void Application_Startup(object sender, StartupEventArgs e)

{

IdeaBladeConfig config = IdeaBladeConfig.Instance;

config.ObjectServer.RemoteBaseUrl = "http://" + HtmlPage.Document.DocumentUri.Host;

config.ObjectServer.ServerPort = HtmlPage.Document.DocumentUri.Port;

config.ObjectServer.ServiceName = "TallyIntegratorWeb/ServicesTally/EntityService.svc";

 
After upgrading from 2009 I figured it was no longer neccessary to use the app.config file, so there is no app.config for the application. However, I have tried adding one with the same info as specified above:
 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

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

<objectServer remoteBaseURL="http://localhost" serverPort="80" serviceName="TallyIntegratorWeb/TallyService/EntityService.svc" />

</ideablade.configuration>

</configuration>

But it did not make a difference. With or without the app.config file, the error I get is this:
 
 
It seems to me as if the application is trying to call the "Virtual" Devforce 2010 EntityService?
 
Thank you for your help
 
Rasmus


Posted By: kimj
Date Posted: 26-Aug-2010 at 12:25pm
OK, maybe the problem is server-side.  In DevForce 2010 we use a virtual path provider, registered in the global.asax, to "virtually" serve the .svc files, so if you haven't placed the .svc files in your folder check that the asax is correct.  In DF 2010 we also changed the contents of the .svc files, so if you are using physical .svc files check the sample config files to make sure yours have the correct content.  Finally, try navigating via your web browser to http://localhost/TallyIntegratorWeb/ServicesTally/EntityService.svc - http://localhost/TallyIntegratorWeb/ServicesTally/EntityService.svc to see if the default service configuration page comes up, or if errors are displayed. 


Posted By: rasmus
Date Posted: 26-Aug-2010 at 5:45pm
Hi Kim
 
I have placed the EntityServer/EntityService files in the folder, and the disabled the virtual path provider i the asax file by commenting out this line:

//System.Web.Hosting.HostingEnvironment.RegisterVirtualPathProvider(new IdeaBlade.EntityModel.Web.ServiceVirtualPathProvider());

The content of the physical .svc files :

<%@ ServiceHost Language="C#" Service="IdeaBlade.EntityModel.Server.EntityServer"

Factory="IdeaBlade.EntityModel.Server.EntityServerHostFactory" %>

and
 

<%@ ServiceHost Language="C#" Service="IdeaBlade.EntityModel.Server.RemoteEntityService"

Factory="IdeaBlade.EntityModel.Server.EntityServiceHostFactory" %>

Navigating to http://localhost/TallyIntegratorWeb/ServicesTally/EntityService.svc - http://localhost/TallyIntegratorWeb/ServicesTally/EntityService.svc  works fine. I think the server side is ok.



Posted By: kimj
Date Posted: 26-Aug-2010 at 7:43pm
Check the debug log for the web application to see what addresses the EntityService is listening on (you'll first need to browse to the .svc to get the service started).  It's possible that the SL endpoint was not configured:  in DF 2010 we now configure endpoints by default based on your license - so if you have a Silverlight license only an SL endpoint (identified by the "/sl" suffix) is created; while if you have a WinClient license only a "standard" endpoint is created; both endpoints will be used if you have a Universal license.   The log file will indicate your license and the endpoints used.
 
If everything looks good there, the only other thing I can think of is the names - I've seen both "TallyIntegratorWeb/ServicesTally/EntityService.svc" and "TallyIntegratorWeb/TallyService/EntityService.svc" used in this thread, so is it possible the client isn't using the same name as the server?


Posted By: rasmus
Date Posted: 26-Aug-2010 at 10:59pm
Hi
 
You are correct, the serviceName in the app.config was wrong. However, correcting it did not make a difference. Would you agree that with DevForce 2010 I could actually do without the app.config, since the only thing it contains is the adress of the endpoint, and I provide this information programatically?
 
It seems that the endpoint is created correctly:
Date Time UserName Namespace Class:Method Message
2010-08-27 07:48:31 IdeaBlade.Core TraceFileXmlLogger::GetLogHeader ------------ Log Created ------------
2010-08-27 07:48:29 IdeaBlade.Core IdeaBladeConfig::Initialize Initializing configuration ...
2010-08-27 07:48:30 IdeaBlade.Core.Composition PartsCatalog::LoadCatalog MEF assembly probing started: 27-08-2010 07:48:30. If this takes a long time, use IdeaBlade.Core.Composition.CompositionHost to specify/restrict which assemblies to probe.
2010-08-27 07:48:30 IdeaBlade.Core.Composition PartsCatalog::LoadCatalog Assembly 'NextStay.TallyIntegrator, Version=4.0.0.0, Culture=neutral, PublicKeyToken=00d64b145a86e3e8' added to PartsCatalog
2010-08-27 07:48:30 IdeaBlade.Core.Composition PartsCatalog::LoadCatalog MEF assembly probing completed: 27-08-2010 07:48:30
2010-08-27 07:48:30 IdeaBlade.Core AuthHelper::LoadRuntimeLicense IdeaBlade License: 'EnterpriseSL', KeyDate: 14-09-2009, AllowedSessions: 10000. Found on Assembly: 'NextStay.TallyIntegrator.DomainModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=00d64b145a86e3e8'
2010-08-27 07:48:30 IdeaBlade.Core.Configuration ServerSettingsElement::ConstrainSettingsBasedOnLicenseCore Could not find a valid license to enable session-agnostic load balancing.
2010-08-27 07:48:31 IdeaBlade.Core.Composition CompositionHost::GetImportDefMultiple Probed for non-default 'ITraceLoggerProvider' and found no matching exports.
2010-08-27 07:48:31 IdeaBlade.Core.Composition CompositionHost::GetImportDefSingle Probed for default 'ITraceLoggerProvider' and found 'IdeaBlade.Core.DefaultLoggerProvider'.
2010-08-27 07:48:31 IdeaBlade.Core TraceFns::CompleteTracingInitialization IdeaBladeConfig resolution: File: C:\Data\Projects\Tally\TallyIntegratorWeb\NextStay.TallyIntegratorWeb\web.config - found
2010-08-27 07:48:31 IdeaBlade.Core TraceFns::CompleteTracingInitialization IdeaBladeConfig resolution: Logging file: C:\Data\Projects\Tally\TallyIntegratorWeb\NextStay.TallyIntegratorWeb\log\DebugLog.xml
2010-08-27 07:48:31 IdeaBlade.Core TraceFns::CompleteTracingInitialization Bound to .NET runtime version 4.0.30319.1
2010-08-27 07:48:31 IdeaBlade.Core TraceFns::CompleteTracingInitialization DevForce version 6.0.4.0
2010-08-27 07:48:42 IdeaBlade.EntityModel.Server EntityServiceHost::AddBehaviors Using DC serializer for EntityService
2010-08-27 07:48:42 IdeaBlade.Core.Composition CompositionHost::GetImportDefSingle Probed for any 'ServiceHostEvents' and found 'IdeaBlade.EntityModel.Server.ServiceHostEvents'.
2010-08-27 07:48:42 IdeaBlade.EntityModel.Server EntityServiceHostFactory::CreateServiceHost EntityService listening on http://hpwin7laptop/TallyIntegratorWeb/ServicesTally/EntityService.svc


Posted By: kimj
Date Posted: 27-Aug-2010 at 10:54am

In DevForce 2010 you do not need an app.config in the Silverlight application.  DF will build a default IdeaBladeConfig instance and use the XAP's source information to build the <objectServer> tag.  Prior to 6.0.5 (which will be released next week), we did not support virtual directories with sub-folders (ie, virtual directory names like you're using).

Actually, I'm not so sure the EntityService did start correctly, or else the final line is missing from the log.  We should also see a trace message that the service is listening on http://hpwin7laptop/TallyIntegratorWeb/ServicesTally/EntityService.svc/sl - http://hpwin7laptop/TallyIntegratorWeb/ServicesTally/EntityService.svc/sl , the SL-specific endpoint.   I should have asked about your service configuration earlier - are you defining the services in the serviceModel section of the web.config?  That's another thing that has changed from DF 2009 - you do not need to use the serviceModel section unless you need to override defaults, and if you do use it the SL endpoint name was changed in DF 2010 to include that /sl suffix.  (This was done because a single BOS can now support both WinClient and Silverlight clients, using separate endpoints for each.)


Posted By: rasmus
Date Posted: 01-Sep-2010 at 3:17am
Hi Kim
 
I don't think the http://hpwin7laptop/TallyIntegratorWeb/ServicesTally/EntityService.svc/sl - http://hpwin7laptop/TallyIntegratorWeb/ServicesTally/EntityService.svc/sl  should be in the log, since I am not using the virtual path provider; I have removed the line

System.Web.Hosting.HostingEnvironment.RegisterVirtualPathProvider(new IdeaBlade.EntityModel.Web.ServiceVirtualPathProvider()); 

from the Global.asax.

In my serviceModel section I have this, since I do wish to override the defaults:

<services>

<service name="EntityService">

<endpoint address="" binding="customBinding" bindingConfiguration="customBinaryBinding" contract="IdeaBlade.EntityModel.IEntityServiceContract" />

</service>

<service name="IdeaBlade.EntityModel.Server.EntityServer">

<endpoint address="" binding="customBinding" bindingConfiguration="customBinaryBinding" contract="IdeaBlade.EntityModel.IEntityServerContract" />

</service>

</services>

In my serverside project I have a folder named: ServicesTally containing the EntityServer.svc and EntityService.svc files. When I define the endpoints in my SL-project using the ServiceReferences.ClientConfig file, the SL client connects to the endpoint without problems, but when creating the endpoints programmatically I end up with the situation described above.
 
 
 
 


Posted By: kimj
Date Posted: 01-Sep-2010 at 9:29am
The VirtualPathProvider just serves the .svc files, it doesn't have anything to do with endpoints.   We should still see a message in the log indicating what endpoints the services are listening on. 
 
If you're using programmatic endpoints on the SL side then that's why the "/sl" suffix is expected.  In the serviceModel section of your web.config the endpoint addresses should be "sl" instead of blank.  The sample web.config in the deployment snippets - http://drc.ideablade.com/xwiki/bin/view/Documentation/Topic_Deployment - http://drc.ideablade.com/xwiki/bin/view/Documentation/Topic_Deployment  - shows an example of these endpoint definitions.



Print Page | Close Window