Print Page | Close Window

deployment to DiscountASP

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=1852
Printed Date: 25-Mar-2025 at 7:23am


Topic: deployment to DiscountASP
Posted By: DataMan
Subject: deployment to DiscountASP
Date Posted: 27-May-2010 at 5:18pm
I'm coming from client server development with the Ideablade classic product and just starting our with silverlight.  I'm trying to get the hard parts out of the way before I actually start on the UI development (which is usually the fun stuff).  I want to use the project of "Silverlight App with Seperate Model projects" in VS2010 as an example to deploy.
 
Does anyone have a quick cheat sheet or list of instructions on how a person would deploy this application to DiscountASP.net with a SQL server backend? 
 
I know it is kind of lazy to send out an e-mail asking for something that people have bashed their heads over for hours and hours and finally at 3:00 in the morning they get that A-Ha moment and everything works perfectly.  Although I've had a lot of success with the classic product so I'm assuming that the Silverlight product will be the same.
 
I don't really want to spend hours and hours figuring out something that someone already did.  If I have to, of course, I'll push up my sleeves and get to work.
 
Thanks
 
 
 



Replies:
Posted By: DataMan
Date Posted: 27-May-2010 at 6:37pm
Found the Deployment.pdf in the instructional units so I'll do that tonight and see how it goes.


Posted By: ting
Date Posted: 27-May-2010 at 7:00pm

We've simplified some aspects of deployment in DevForce 2010 that may not yet be reflected in the documentation.  For example, for standard deployments, you may not need to use the app.config or EntityService.svc files anymore.  Also, check out the Snippets folder under Deployment for some more examples.

You may also want to grab the latest DevForce patch from this thread as it addresses a configuration issue:
http://ideablade.com/forum/forum_posts.asp?TID=1840 - http://ideablade.com/forum/forum_posts.asp?TID=1840
 


Posted By: DataMan
Date Posted: 27-May-2010 at 10:14pm
Hi there,  thanks for the note on the patch!
 
So I created an even simpler silverlight application from the tour pdf's and used it to connect to the tables up hosted in my SQL DB at DiscountAsp.net.
 
Runs fine on my local machine and when I put it up on the site using the directions from the "Deploying to IIS7" instructions from the Deployment.PDF no errors occur BUT there is no data in the grid.  I do notice that the grid knows the columns in the table so it has to be connecting to the database somehow right?
 
I added the logging to the application shown in 100SLV tour pdf's and no errors are occuring in the application that I can see.
 
I use SQL logins to connect to the discountASP.net server and the connection string will be the same as when it's running on my local machine so I don't have to change anything there.
 
I do see the snippets in the depployment section have ones called sample n-tier config files and as well the deployment.pdf lists something about "11. Copy any .aspx files, the web.config, Global.asax, EntityService.svc, EntityServer.svc, and Silverlight.js files to the application folder".  I don't have any EntityService.svc files in my project,  should I?
 
Nor do I have an app.config file in my project,  do I need one of those on the server? 
 
The deployment.pdf also says that the debuglog.xml will be in the log folder but I don't have anywhere in the project telling the app where the log folder is.
 
Just the fact that it's showing the grid columns is giving me faint hope that something is working.
 
Any suggestions would be welcome.
 


Posted By: smi-mark
Date Posted: 28-May-2010 at 8:19am
The grid columns come from the generated classes, not from the database, so it is possible you aren't connecting/querying. The DebugLog.xml should be in the same folder as the web.config, under a default configuration. 


Posted By: ting
Date Posted: 28-May-2010 at 6:39pm
For basic deployments (as I believe is your case) you no longer need an app.config in the client or the .svc files on the server. 
 
The details:
  • Instead of getting the server URL from the app.config file, DevForce will infer this from the location where the XAP was downloaded.
  • Instead of using the .svc files, DevForce registers a virtual path provider in the global.asax on the server which will dynamically create the services.

The first step in checking your deployment is to open http://%5bhostdomain%5d/%5bpath%5d/EntityService.svc - http://[hostdomain]/[path]/EntityService.svc in a web browser.  This will tell you if the service successfully started and what the error was if it failed.  After that, you can check the server-side debuglog for additional information.



Posted By: DataMan
Date Posted: 28-May-2010 at 8:35pm
Ok,  atleast that's an error...
 
This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item
 
[ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item]
   System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item) +12089046
   System.Collections.Generic.SynchronizedCollection`1.Add(T item) +78
   System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses) +72
   System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +141
   IdeaBlade.EntityModel.Server.EntityServiceHostFactory.CreateHostCore(Type serviceType, Uri[] baseAddresses) +30
   IdeaBlade.EntityModel.Server.EntityServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +40
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +420
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1440
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +615

[ServiceActivationException: The service '/EntityService.svc' cannot be activated due to an exception during compilation.  The exception message is: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item.]
   System.Runtime.AsyncResult.End(IAsyncResult result) +679246
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
   System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar) +300622
   System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar) +8837348
So just to go through what I've done:
 
1) Created silverlight project using the same connection string that would be used on the discountasp.net server
1a) added Loaded += delegate { DataContext = new MainPageViewModel(); }; to the MainPage.xaml.cs
 
1b) put the following in the mainviewmodel.cs file:
Log = new ObservableCollection<string>();
WriteToLog("Initializing View Model");
DD_Tables = new ObservableCollection<DD_Table>();
var mgr = new SQL2008_673586_timeentryEntities();
var query = mgr.DD_Table;
query.ExecuteAsync(op => op.Results.ForEach(DD_Tables.Add));
WriteToLog("End of event");
1c) put a bunch of other code required in different places following the SimpleSteps demo.
2) Created a bin, clientbin and log directories in the root of the website.
3) copied everything from the BIN directory in the project to the bin directory of the website
4) Copied the xap file from the project clientbin to the clientbin web folder
5) Copied the default.aspx, global.aspx, silverlight.js, web.config to the root of the website.
 
That's all I did. I didn't change the web.config in anyway nor did I change permissions on files on the webserver anywhere.  The anonymous user on discountasp.net has write access to the files and folders.
 
What did I miss?
 
 


Posted By: DataMan
Date Posted: 28-May-2010 at 9:05pm

ok,  added multipleSiteBindingsEnabled="true" to the web.config file as per a help file on discountasp.net

https://support.discountasp.net/KB/a799/error-accessing-wcf-service-this-collection-already.aspx?KBSearchID=160591 - https://support.discountasp.net/KB/a799/error-accessing-wcf-service-this-collection-already.aspx?KBSearchID=160591
 
Now I'm Getting
 
Metadata publishing for this service is currently disabled.

If you have access to the service, you can enable metadata publishing by completing the following steps to modify your web or application configuration file:

1. Create the following service behavior configuration, or add the <serviceMetadata> element to an existing service behavior configuration:
<behaviors>
    <serviceBehaviors>
        <behavior name="MyServiceTypeBehaviors" >
            <serviceMetadata httpGetEnabled="true" />
        </behavior>
    </serviceBehaviors>
</behaviors>
Now to try to figure out more on why it's not working


Posted By: smi-mark
Date Posted: 28-May-2010 at 9:08pm
Have you tried connecting again with SL? The metadata message, though cryptic, isn't actually an error.


Posted By: DataMan
Date Posted: 28-May-2010 at 9:17pm
Nada, Still no record showing.
 
I even looked at the other post about deployment and put in
 
 <client>
      <endpoint name="EntityService"
                address=" http://mywebsite/EntityService.svc/sl - http://mywebsite/EntityService.svc/sl "
                binding="customBinding" bindingConfiguration="customBinaryBinding"
                contract="IdeaBlade.EntityModel.IEntityServiceContractAsync"
                />
      <endpoint name="EntityServer"
                address=" http://mywebsite/EntityServer.svc/sl - http://mywebsite/EntityServer.svc/sl "
                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>
into my web config file, changing the address and it didn't seem to make a difference.
 


Posted By: smi-mark
Date Posted: 28-May-2010 at 9:20pm
You aren't seeing anything in the DebugLog.xml file either? Is your SL app reporting any exceptions?

When you're seeing that metadata publishing message, it sounds like you're connecting ok.

Can you put some logging into the ExecuteQueryAsync callback on your EntityManager and see if it is returning an error?


Posted By: DataMan
Date Posted: 28-May-2010 at 9:28pm
Thanks for mentioning that! 
 
I finally have a debuglog.xml but it is 0 size and when I try to transfer it from the FTP it says it is in use.  I'm thinking I can take down the website but then it might not write to the debuglog.
 
I'm really new to SL so I will research how to add logging into the async connect callback to the entitymanager. 
 
Thanks
 
 


Posted By: smi-mark
Date Posted: 28-May-2010 at 9:31pm
Size 0 sounds a bit odd, but at least that is good news. That means DevForce is at least partially working. In the older versions of DevForce you could just browse to the DebugLog (not good in production, but it should be disabled or locked down anyways in production).

In the callback of your ExecuteQueryAsync the EntityQueryOperation args should have a property called 'Error' you should check if this isn't null, if not, write the message out to the screen.

I have a feeling you have an error in there.


Posted By: DataMan
Date Posted: 28-May-2010 at 9:45pm
As I figured,  the system just had to let go of the file after a bit.
 
Message
------------ Log Created ------------
Initializing configuration ...
The configured SupportedClientApplicationType is Both
Probed for non-default 'ITraceLoggerProvider' and found no matching exports.
Probed for default 'ITraceLoggerProvider' and found 'IdeaBlade.Core.DefaultLoggerProvider'.
IdeaBladeConfig resolution: File: xxx\htdocs\web.config - found
IdeaBladeConfig resolution: Logging file: E:\web\xxx\htdocs\log\DebugLog.xml
Bound to .NET runtime version 4.0.30319.1
DevForce version 6.0.2.0
Using DC serializer for EntityService
Probed for any 'ServiceHostEvents' and found 'IdeaBlade.EntityModel.Server.ServiceHostEvents'.
EntityService listening on http://xxx.net/EntityService.svc
EntityService listening on http://xxx.net/EntityService.svc/sl
Probed for any 'EntityServiceApplication' and found 'IdeaBlade.EntityModel.EntityServiceApplication'.
EntityService created
EntityServer created for DataSourceExtension: [None]
Anonymous access: enabled
Probed for non-default 'IEntityLoginManager' and found no matching exports.
No Login Manager found. User will always be logged in as Guest, regardless of credentials.
Probed for any 'IEntityQueryExecutor' and found 'IdeaBlade.EntityModel.Edm.EdmQueryExecutor'.
Probed for any 'IEntityQueryExecutor' and found 'IdeaBlade.EntityModel.Edm.PassthruEsqlQueryExecutor'.
Probed for any 'IEntityQueryExecutor' and found 'IdeaBlade.EntityModel.Edm.StoredProcQueryExecutor'.
Probed for any 'IEntityQueryExecutor' and found 'IdeaBlade.EntityModel.Edm.UdtQueryExecutor'.
Probed for non-default 'IKnownTypeProvider' and found no matching exports.
Using DC serializer for EntityServer
EntityServer listening on http://xxx.net/EntityServer.svc
EntityServer listening on http://xxx.net/EntityServer.svc/sl
Probed for any 'EntityServerQueryInterceptor' and found 'IdeaBlade.EntityModel.Server.EntityServerQueryInterceptor'.
Fetch ... value(IdeaBlade.EntityModel.EntityQueryProxy`1[SimpleSteps.DD_Table])
Probed for default 'IDataSourceKeyResolver' and found 'IdeaBlade.EntityModel.DefaultDataSourceKeyResolver'.
Probed for non-default 'IDataSourceKeyResolver' and found no matching exports.
Probed for any 'IIdGenerator' and found 'IdeaBlade.EntityModel.StoreGeneratedIdGenerator'.
Probed for non-default 'IConcurrencyStrategy' and found no matching exports.
Probed for default 'IConcurrencyStrategy' and found 'IdeaBlade.EntityModel.DefaultConcurrencyValueSetter'.
DataSourceKey:xxxEntities found in assembly: SimpleSteps, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Fetch ... value(IdeaBlade.EntityModel.EntityQueryProxy`1[SimpleSteps.DD_Table])
 
So it seems to be working, no errors that I can see are found. 
 
I see what you mean about the execute and the args,  It will take me a while to figure out how to return the error codes from there but that's the fun about learning a new language.
 
 
 
 


Posted By: smi-mark
Date Posted: 28-May-2010 at 9:50pm
A quick and easy way would be to simply throw a TextBlock on your view, and on the return of the execute, simply set the text property from there. Obviously there are many more elegant solutions, but this is a quick and dirty way :)


Posted By: DataMan
Date Posted: 28-May-2010 at 9:56pm
Funny, you are overestimating my knowledge in SL :-)  The textblock part and logging the error is the easy part.  Figuring out how to get the args from the ExecuteAsync call is the hard part for me :-)
 
I'll figure it out at somepoint,  this is the stuff I have to learn.  I've been working on Devforce Classic for so long that Linq and all this new stuff just passed me by and I'm feeling old.
 
Now that I know that at least it's working and that I can start debugging and returning stuff from the backend I can usually muscle my way through.
 
Thanks


Posted By: smi-mark
Date Posted: 28-May-2010 at 10:00pm
Replace:

query.ExecuteAsync(op => op.Results.ForEach(DD_Tables.Add));

With:

query.ExecuteAsync(GotEntities);

private void GotEntities(EntityQueryOperation<DD_Table> args)
{
    if (args.Error != null)
   {
       _textBlockError.Text = args.Error.Message;
   }
   else
   {
      args.Results.ForEach(DD_Tables.Add);
    }
}


Posted By: DataMan
Date Posted: 28-May-2010 at 10:50pm

Ok,  I looked at your post when I heard the e-mail come in.  I shouldn't have but I did :-)

The error is a simple "Not Found"
 
System.ServiceModel.CommunicationException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.
   at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelAsyncRequest.CompleteGetResponse(IAsyncResult result)
   --- End of inner exception stack trace ---
   at IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
   at IdeaBlade.EntityModel.EntityManager.AsyncFetchWorker(AsyncEventArgs state)


Posted By: smi-mark
Date Posted: 28-May-2010 at 10:56pm
Sounds as if your web.config is pointing at the wrong address. I would suggest using a tool such as Fiddler to see where it is really connecting to.

http://www.fiddler2.com/fiddler2/


Posted By: DataMan
Date Posted: 29-May-2010 at 12:36am
Ok,  I didn't figure out what the exact problem was but I started looking at my SQL connection and noticed that it had some metadata stuff that was pointing at nothwind and I then remembered when I was creating the project I used the nothwind by accident and then hit back and created a new connection with my discountasp.net database.
 
I can't see why that would have been the problem but I then thought I would start from scratch and try the tutorial again.  I called it SimpleSteps2 and coded it and uploaded it to the web and voila,  it worked.
 
Thanks for all your help especially on a late friday night!
 
Now that this is working I find it hard to believe how easy it really was.  I also think the deployment of the silverlight project is a heck of a lot easier than asp.net! 
 
I also thought getting it hosted on DiscountAsp.net would have been harder but it wasn't.  All of their directories and mimetypes etc are all setup properly.  There's not much to do except put the files in the right place and make a simple change to the web.config to enable the multisomethingorother. 
 
Considering it was a few hours to build the simplest project and get it running on a web page without having any knowledge of Silverlight, WCF and a only a basic knowledge of ASP.net I'm feeling pretty good about the rest of the project!
 
Thanks



Print Page | Close Window