Quantcast
Channel: WCF RIA Services with Silverlight forum
Viewing all 362 articles
Browse latest View live

RIA DomainService Query Error Occurs When Used in Concert With HTTPS, HasSideEffects = TRUE, and Client-Side OrderBy

$
0
0

Greetings.

I have a Silverlight 4 application that communicates with the server via HTTPS. In this application I have a view that calls a RIA DomainService query I created named "GetCustomersByIDQuery" to which I pass a list of customer IDs. Because I may need to send many IDs, I have decorated the query with the “HasSideEffects" attribute so that my IDs will be placed into the body of the HTTPS request and not exceed the URI length. When I attempt to access my view, I receive the following error:

*** Message ***

Load operation failed for query 'GetCustomersByID'. Error in deserializing body of request message for operation 'GetCustomersByID'. OperationFormatter encountered an invalid Message body. Expected to find node type 'Element' with name 'GetCustomersByID' and namespace 'http://tempuri.org/'. Found node type 'Element' with name 'MessageRoot' and namespace ''

*** Stack Trace ***

   at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error)

   at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error)

   at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult)

   at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.<Load>b__17(Object )

After some trial and error, I have deduced that the combination of HTTPS, HasSideEffects = true, and a client-side LINQ "OrderBy" (see code below) attached to the query "GetCustomersByIDQuery" is causing the problem. If I maintain both HTTPS and HasSideEffects = true, but remove the OrderBy clause, the error disappears. Similarly, if I maintain both HTTPS and the OrderBy clause, but I remove HasSideEffects = true, the error disappears. Finally, if I maintain both the OrderBy clause and HasSideEffects = true, but use HTTP (instead of HTTPS) the error disappears. In the end, however, I need all three to work in conjunction with each other.

Now, I know that I could either 1) place the OrderBy in the DomainService query or 2) perform the sort client-side once I've retrieved my data. However, my example in this post is really just a simplistic stand-in for a real-world query that is using client-side OrderBy, IncludeTotalCount, Sort, Where, Skip, and Take in conjunction with a Telerik GridView that is bound to a VirtualQueryableCollectionView.

On final thing to mention -- when the OrderBy is included in an HTTP request, "?orderby=it.LastName" appears in the QueryString. However, when requested via HTTPS, no "orderby" appears in the QueryString (why the difference?), but rather the "orderby" appears in the body of the HTTPS request along with the content below. Here “MessageRoot” as referenced in the error above, is what the serializer is complaining about.

@

MessageRoot@

QueryOptions@

QueryOptions Name?orderby

Value?

Here is my code.

[Query(HasSideEffects = true)]
public IQueryable<Customer> GetCustomersByIDQuery(List<int> ids)
{
	int[] filter = ids.ToArray<int>();

	return ObjectContext.Customers.Where(s => filter.Contains(s.ID));
}

List<int> customerIDs = new List<int>(){1,2,3};
DM.Context.Load(DM.Context.GetCustomersByID(customerIDs).OrderBy(ob => ob.LastName), (LoadOperation<Customer> lo) =>
{
	// Perform processing.
}, null);

I tried hard to perform my due diligence with regard to researching this issue. Unfortunately, I could not find any information regarding the three settings above working in concert. I would appreciate any help you could provide. Thanks.

- Steve

** UPDATE 17-OCT-2011 **

In my previous update I wondered why the "orderby" was in the QueryString during an HTTP request and in the body of an HTTPS request. When my team accidentally set "security mode" = "transport" in the Web.config for our non SSL site, the switch occurred (the "orderby" started appearing in the body of the request). This doesn't solve my problem, but it may be a lead.

** UPDATE 12-OCT-2011  **

Since no one has yet commented on this post, I thought that I would mention the following:

  1. The combinations I describe above of turning on/off HTTPS, HasSideEffects, and OrderBy all occur on the same machine. So, my DLLs are the same (someone at http://social.msdn.microsoft.com/Forums/en-US/silverlightwcf/thread/111a5dfa-20c3-4792-9c3b-9be06a4e29cc//1?Error+deserializing+when+using+HasSideEffects+true+and+paging commented that a problem similar to this could be caused by a difference in DLL versions).
  2. I did see the post at http://social.msdn.microsoft.com/Forums/en-US/silverlightwcf/thread/111a5dfa-20c3-4792-9c3b-9be06a4e29cc//1?Error+deserializing+when+using+HasSideEffects+true+and+paging which mentioned a solution at http://stackoverflow.com/questions/492407/operationformatter-encountered-an-invalid-message-body. Unfortunately, this solution is not using a RIA DomainService query and, therefore, I believe can / will not have an OperationContract where I can specify a different WebMessageBodyStyle.
  3. I saw the post at http://social.msdn.microsoft.com/Forums/en-US/silverlightwcf/thread/f687bf09-a32d-4932-9434-3eacaabbd4ae#fb4b9418-8389-43b8-b1d4-646c1354df80. While the post is marked as answered, the OP never mentions what fixed the problem. In addition, the user had their OrderBy in the server method, not the client (mine is on the client). With respect to the suggestions, my query method does get hit using HTTPS and all other methods not using an OrderBy work in HTTPS. I will concede (as I mention above) that the HTTP request differs from the HTTPS request in that when requested via HTTP, the OrderBy appears in the QueryString whereas it does not in the HTTPS request (unfotunately, I don't know why).

                       

Best way to add properties to entities.

$
0
0

I'm working on a project that loads entities through a data context and displays the results in a DataGrid.  The DataGrid's ItemSource property is binded to the particular entity set on the data context that I want displayed. 

Since I also need to display some additional columns in the data grid whose data are not database columns of the entity, I have created a partial class for the entity and added the additional properties that I need.  In the example below I have created a property called YearMonth that combines two database properties and then listens to changes to those properties and raises a property changed notification on change.  This works fine.

public partial class Actual
{
        public YearMonth? AsYearMonth
        {
            get { return YearMonth.TryNew(FiscalYear, FiscalMonth); }
        }
        partial void OnFiscalYearChanged()
        {
            RaisePropertyChanged("AsYearMonth");
        }

        partial void OnFiscalMonthChanged()
        {
            RaisePropertyChanged("AsYearMonth");
        }
}

Now I have also extended the class to add a more complex property like this below. This property makes use of other entities in the data context to perform the calculation. The problem occurs when the context is loaded. As entities are loaded, they are added to the entity set and a collection changed notification gets generated in which the DataGrid listens and begins refreshing the grid. When the grid goes to read this property it does not always return the correct result because sometimes the needed entities have not been loaded yet.  Of course this is a race condition depending on which entity set gets loaded first.  How do I resolve this problem?

public partial class Actual
{
    public decimal? AsFTE
    {
        get
        {
            FiscalYearMonth fiscalYearMonth = MyAppDataModelHelper.GetFiscalYearMonth(
                EntitySet.EntityContainer.GetEntitySet<FiscalYearMonth>(), 
                FiscalYear, FiscalMonth);
            return FiscalYearMonth.GetFteFromHours(fiscalYearMonth, Hours);
        }
    }

    partial void OnHoursChanged()
    {
        RaisePropertyChanged("AsFTE");
    }
}

Entity Framwork 6 Primary Key configuration issue on save of Entities

$
0
0

I'm trying to save few entities with the below code.

this.UserService.Users.Add(eUser);

        if (SelectedRewindItems != null && SelectedRewindItems.Count > 0)
        {
            foreach (var ug in SelectedRewindItems)
            {
                HpmModel.Usergroup nUg = new HpmModel.Usergroup();
                decimal numId;
                var a = Decimal.TryParse(ug.Key.ToString(), out numId);
                nUg.Groupid = numId;
                nUg.Userid = eUser.Userid;
               // eUser.Usergroups.Add(nUg);
                this.UserService.Usergroups.Add(nUg);

            }
        }
        var submitOp = this.UserService.SubmitChanges();
        IsSuccess = true;
        ActionMessageOnButtonSuccess = User.Fname + " " + User.Lname + " Added Successfully !!";
        string message = null;
        if (submitOp.EntitiesInError.Any())
        {
            message = string.Empty;
            Entity entityInError = submitOp.EntitiesInError.First();
            if (entityInError.EntityConflict != null)
            {
                EntityConflict conflict = entityInError.EntityConflict;
                foreach (var cm in conflict.PropertyNames)
                {
                    message += string.Format("{0}", cm);
                }
            }
            else if (entityInError.ValidationErrors.Any())
            {
                message += "\r\n" + entityInError.ValidationErrors.First().ErrorMessage;
            }
            MessageBox.Show(message);
        }
        else {
            MessageBox.Show("Submit Done");
        }

But I'm getting the below error

System.InvalidOperationException was unhandled by user code
  HResult=-2146233079
  Message=The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: Saving or accepting changes failed because more than one entity of type 'HpmModel.Usergroup' have the same primary key value. Ensure that explicitly set primary key values are unique. Ensure that database-generated primary keys are configured correctly in the database and in the Entity Framework model. Use the Entity Designer for Database First/Model First configuration. Use the 'HasDatabaseGeneratedOption" fluent API or 'DatabaseGeneratedAttribute' for Code First configuration.
  Source=EntityFramework
  StackTrace:
       at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
       at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass2a.<SaveChangesInternal>b__27()
       at System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute[TResult](Func`1 operation)
       at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
       at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
       at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges()
       at OpenRiaServices.DomainServices.EntityFramework.LinqToEntitiesDomainService`1.InvokeSaveChanges(Boolean retryOnConflict) in c:\Code\Repos\openriaservices\OpenRiaServices.DomainServices.EntityFramework\Framework\LinqToEntitiesDomainService.cs:line 145
       at OpenRiaServices.DomainServices.EntityFramework.LinqToEntitiesDomainService`1.PersistChangeSet() in c:\Code\Repos\openriaservices\OpenRiaServices.DomainServices.EntityFramework\Framework\LinqToEntitiesDomainService.cs:line 138
       at OpenRiaServices.DomainServices.Server.DomainService.PersistChangeSetInternal()
       at OpenRiaServices.DomainServices.Server.DomainService.Submit(ChangeSet changeSet)
  InnerException: System.InvalidOperationException
       HResult=-2146233079
       Message=Saving or accepting changes failed because more than one entity of type 'HpmModel.Usergroup' have the same primary key value. Ensure that explicitly set primary key values are unique. Ensure that database-generated primary keys are configured correctly in the database and in the Entity Framework model. Use the Entity Designer for Database First/Model First configuration. Use the 'HasDatabaseGeneratedOption" fluent API or 'DatabaseGeneratedAttribute' for Code First configuration.
       Source=EntityFramework
       StackTrace:
            at System.Data.Entity.Core.Objects.ObjectStateManager.FixupKey(EntityEntry entry)
            at System.Data.Entity.Core.Objects.EntityEntry.AcceptChanges()
            at System.Data.Entity.Core.Objects.ObjectContext.AcceptAllChanges()
            at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
       InnerException: 

When I checked the Database Entities got saved but still it is giving me this issues.

Is this because I'm trying save them after saving User & Then UserGroup entities separatly. or Child Entities should get saved with Parent Entities. I'm a beginner so facing challanges.


akirti

start oob app

$
0
0

I have a silverlight application  consist many ria service libraries.

I can't start it in OOB now, Can't debug either.

What's wrong?

Silverligh + WCF. Mtom encoding problem.

$
0
0

Hi there

When using Text endpoint encoding (Silverlight 5.0 client), everything goes smoothly. But when I switch it to:

<binding name="TimeCardBinding" closeTimeout="00:59:00" openTimeout="00:59:00"
          receiveTimeout="00:59:00" sendTimeout="00:59:00" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"
          transferMode="Buffered" 

messageEncoding="Mtom"><readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /><security mode="Transport"><transport clientCredentialType="None" /></security></binding>

i.e. use Mtom encoding instead of Text, my client never get updated (I use Visual Studio Update Service refernce function). So the portion

<endpoint address="..TimeCardService.svc" binding="basicHttpBinding"
                bindingConfiguration="BasicHttpBinding_TimeCardService" contract="TimeCardServiceReference.TimeCardService"
                name="BasicHttpBinding_TimeCardService" />

simply disappears from the ServiceReference.ClientConfig file with no error message. If I manually insert it to there, it stops working with more meaningless message raises.

Why Mtom is not working for me?

Thanks.

install eror

$
0
0

getting an error 2753 when uninstalling microsoft silverlight. tried cmd but I have no run as administrator option. Tried silverlight.diagcab but can't find program to open diagcab file. Any ideas?

Creating and configuring an IIS Site

$
0
0

I am trying to set up an IIS site in IIS 7. for a SharePoint 2010 web part. When I click Test Connection during the site setup, I get this warning/error for Authorization:

"The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that <domain>\<computer_name>$ has Read access to the physical path. Then test these settings again."

True enough, when I right-click the .svc file for this site, it gives me an error saying there are insufficient permissions to read the web.config. If there is no error, then the configuration was done correctly.

This is on a server computer running Windows Server 2008. To give insight on this, after I create the site, there are no folders or files populated in it. I thought there should be, because what I am deploying has been deployed on another server, and the setup is similar. I am missing (what I consider) important files in folders and global.asax. The server has no Active Directory.

How do I fix the configuration? Should I copy the files from the "working" server to the current server, or is there more setup that will add those files?

How to Add Property in a Class at Run-time or dynamically (WCF RIA Services + Entity Framework 6.0 + Silver-light, C#/.Net 4.0)

$
0
0

Hello,

I have a grid bind from an entity Say TEntity. I want to display some additional columns in this grid which comes from database using the pivot key word, so the number of returning columns are never fix. So i want to add the properties to TEntity at run-time so that the new columns could be displayed in the grid.

please suggest me if it is possible to add the properties in a class at run-time.




porting to Windows10 and Metro/ Modern tile apps.

$
0
0

Hi,

My development environment is currently Win-7, SQLServer, WCFRIA, Silverlight5.

I need to make the jump to Metro Apps.  Win8, or I suppose now Win10 would be the way to go?

So, in very slow, small steps, what do I need to do?

Can I cross-compile onto a Win-8 host, or should the first thing I do be to pave my development machine and start again?

What is the supported stack?

After that, what are all the good books/ helpful links for Metro XAML +  C# development.

Is WCFRIA still supported?

Many thanks.  It will be quite a big step I think.

Domain service call to [Invoke] method, child collection property populated on the client but empty in the domain service

$
0
0

I have a domain service [Invoke] method, which accepts a parameter of EntityTypeA.  One of EntityTypeA's properties, Prop1, is a List<EntityTypeB>.

In Debug, I can verify that the EntityTypeA on the client side has the Prop1 property populated with 2 entries.  However, when I break in the domain service method, Prop1 count = 0.

What would cause this?  I am at a loss.

Periodically there is an "not found" error

$
0
0

Dear Gurus!

After a successful use of ria services for a long time from some moment  "Not found" error occurs.  After recompiling program or  rerun VS 2012 an error may disappear. After that an error does not occurs. However, it occasionally reappears after another compiling program. I use ria services , PRISM, some my wcf services. What may be the reason? Any ideas will be appreciated.

The "CreateRiaClientFilesTask" task failed unexpectedly. Error 10

$
0
0

I am experiencing an intermittent build error associated my RIA services project. The error is not 100% reproducible, but is more common on less powerful machines.

Here is the error message:

 Error      10
The "CreateRiaClientFilesTask" task failed unexpectedly.
System.Runtime.Remoting.RemotingException: Object '/6a7629fb_5453_47e7_bf71_f71a2285b31d/qk2uiegbivleqhngzpeqedrs_81.rem' has been disconnected or does not exist at the server.
  at System.IDisposable.Dispose()
  at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies()
  at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.ExecuteInternal()
  at Microsoft.ServiceModel.DomainServices.Tools.RiaClientFilesTask.Execute()
  at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
  at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean& taskResult)                McServices (McServices\McServices)


Focusing is getting lost on the Datagrid row for every Domaindatasource refresh

$
0
0

I have a datagrid where data is populated using domaina datasource. and it refreshes every 5 seconds.And also using datapager for the grid

Problem is when domain datasource refreshes and gets data. focus of the row in the grid moves to first row  of the page.

http://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/e047982c-1e22-11e4-80b8-00155d624807

Look at the video in the link where you see the focus of the selected row moves to first row of the page that's what my probelm about.

PS: I tried capturing the focused row during loading data event handler and re-assigning in the loaded data event handler.

though it not work.

Any Help? 

Question
You cannot vote on your own post
0


Here my code

MainPage.xaml

---------------------------------

               

Grid x:Name="LayoutRoot" Background="Transparent">
        <riaControls:DomainDataSource AutoLoad="True" Height="0" Name="alertDomainDataSource" QueryName="GetAlertsQuery" PageSize="20" LoadSize="20"  RefreshInterval="00:00:04" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <my1:TestDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
        <!--<data:DataGrid AutoGenerateColumns="True" ItemsSource="{Binding Data, ElementName=alertDomainDataSource}" x:Name="DataGrid1">

        </data:DataGrid>-->
        <sdk:DataGrid MinHeight="100" IsReadOnly="False" AutoGenerateColumns="True" SelectionMode="Single" ItemsSource="{Binding Data, ElementName=alertDomainDataSource}" Name="dataGrid1">
</sdk:DataGrid>
        <data:DataPager PageSize="10" Source="{Binding Data, ElementName=alertDomainDataSource}"
                      Margin="0,-1,0,0"></data:DataPager>

    </Grid>
</UserControl>

Mainpage.xaml.cs

  public partial class MainPage : UserControl
    {
     //   private SampleDomainContext _sampleContext = new SampleDomainContext();
        private int _currentDataPagerPage = 0;
        private int _focusedRow = 0;

        public MainPage()
        {
            InitializeComponent();
           
  
            alertDomainDataSource.Clear();

                alertDomainDataSource.LoadingData += new EventHandler<LoadingDataEventArgs>(alertDomainDataSource_LoadingData);
                alertDomainDataSource.LoadedData += new EventHandler<LoadedDataEventArgs>(alertDomainDataSource_LoadedData);


           

        }

        void alertDomainDataSource_LoadedData(object sender, LoadedDataEventArgs e)
        {
            dataPager1.PageIndex = _currentDataPagerPage;

            _tableview.FocusedRowHandle = _focusedRow;
        }

        void alertDomainDataSource_LoadingData(object sender, LoadingDataEventArgs e)
        {
            e.LoadBehavior = LoadBehavior.RefreshCurrent;
            _currentDataPagerPage = dataPager1.PageIndex;
            _focusedRow = _tableview.FocusedRowHandle;
        }

       
    }

How to get a entity set by the entity name?

$
0
0

Dear Gurus! 

I have about 100 tables and operator choose  table name from the tree. Entity name is equal to table name and entities set name = entity name + 's'   Can I get  entity set from the DomainContext by the entity name?

Presentation Model - Entity Framework - POCO?

$
0
0

So I have started using more and more of the RIA services CTP. Having used the CTP now for a few weeks

I have come to the conclusion that I will need to craft my own POCO objects for consumption by my various user interfaces.

Assumptions: I'm using RIA services to create an application that emulates a document or form based submission application with some workflow but mostly data entry, reads etc...

NOTE: My entity framework models do contain many to many relationships

Example of what seeing based on my Entity Framework models are:

XAML page A - uses service context A and context B, and context C[] collections "drop downs etc..."

I'm assuming you do not want to make 3+ calls via LoadOperations to your web head and middle tier per page view.

I have taken to implementing POCO's which represent a logical model or document type that tightly couples a given contract for the interface.

Now these POCO's are created melding my existing services to the exact "look and feel" I want to serve up to my Silverlight pages. I'm using multiple business domains so i'm actually abstracting the services layers in some cases and not exposing some of the Service methods directly to the Silveright. Rather I am allowing reads and writes on POCO objects.

The composition of my POCO's are completed on the server for initially.

My question is: Could I accomplish this same type of composite behavior using EntityFramework composition modeling and then using LinqToSQL referencing on associated many to many entities?  Is the intention of the RIA services at this point to simply offer the ability to utilize Service layer disptaching to Sliverlight or more lined with databinding direct control access?

Thanks!


Unable to update Database by OpenRIA and no AttachAsModified method Defined

$
0
0

I've an OpenRIA Domain Service. Here I'm not able to update my Database. I checked during Debug call comes till this Method but No changes on database

// RIA DOMAIN SERVICE
 public void UpdateUser(User currentUser){
        //this.ObjectContext.Users.AttachAsModified(currentUser, this.ChangeSet.GetOriginal(currentUser));
       this.ObjectContext.Users.Attach(currentUser);
    }

original code was (when I created This RIA Domain Services by wizard)

public void UpdateUser(User currentUser){
        this.ObjectContext.Users.AttachAsModified(currentUser, this.ChangeSet.GetOriginal(currentUser));
    }

I didn't find any AttachAsModified Method here why? Is this the reason about no update in Database? or something else.

My Approach for update

In my Silverlight 5 MVVMLight Application, For presentation I've a SelectedUser Property which is of type MUser.cs (not of EntityObject type) once I capture the Data in this Object I fetch the Entity by Key from Context and update its properties & Then run the below Method of ViewModel via Command

public void UpdateFormData(){
        this.UserService.Load(this.UserService.GetUsersQuery(), EditUserOperation,true);
    }
    private void EditUserOperation(LoadOperation<HpmModel.User> op){
        HpmModel.User u = op.Entities.Where(x => x.Userid == SelectedUser.Userid).FirstOrDefault();
        if (u != null){
            ConvertPtOToDtO(u);
            try {
                if (this.UserService.HasChanges){
                   this.UserService.SubmitChanges(HolaUpdateChange, EntityState.Modified);

                }
            }catch(Exception ex){
                MessageBox.Show("Data updation failed due to " + ex.Message);
            }
        }
    }
    private void HolaUpdateChange(SubmitOperation so){
     MessageBox.Show("Data updated successfully!" + so.IsComplete.ToString());
    }
UserService is Also got created once during initialization of ViewModel so is there any possiblity of Disconnected ?




akirti


CreateRiaClientFilesTask" task failed unexpectedly

$
0
0

The "CreateRiaClientFilesTask" task failed unexpectedly.

System.AppDomainUnloadedException: Attempted to access an unloaded AppDomain.

   at System.IDisposable.Dispose()

   at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.GenerateClientProxies()

   at Microsoft.ServiceModel.DomainServices.Tools.CreateRiaClientFilesTask.ExecuteInternal()

   at Microsoft.ServiceModel.DomainServices.Tools.RiaClientFilesTask.Execute()

   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()

   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()        

WCF RIA and WCF Duplex

$
0
0

I need to know if it is possible to have a WCF RIA and WCF Duplex together, I mean a Silverlight client Connects to both of Services throgh a single port?

I've tried it but it seems it has some conflictions, like when RIA tries to Load<> something Duplex disconnect and when Duplex pushes some data to SL Client Ria get confused, and gives timeout error.

Is there any way to have them together without confiliction or may be with 2 diffrent port numbers??


using webclient

$
0
0


Hi,

Using web client in Silverlight, I am encountering this error:

{System.Security.SecurityException ---> System.Security.SecurityException: Security error.
   at System.Net.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
   at System.Net.BrowserHttpWebRequest.<>c__DisplayClass5.<EndGetResponse>b__4(Object sendState)
   at System.Net.AsyncHelper.<>c__DisplayClass2.<BeginOnUI>b__0(Object sendState)
   --- End of inner exception stack trace ---
   at System.Net.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
   at System.Net.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
   at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
   at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)}

my code:

public void login(string userName, string password)
        {
            WebClient client = new WebClient();
            Uri uri = new Uri(serverURI + "/clientaccesspolicy.xml");
            client.OpenReadCompleted += new OpenReadCompletedEventHandler(login_Complete);
            client.OpenReadAsync(uri);
        }

        private void login_Complete(object sender, OpenReadCompletedEventArgs e)
        {
            byte[] buffer = new byte[e.Result.Length]; //crashes here with exception
            ...
        }

what's wrong

Long running queries (sometimes)

$
0
0

I have been tasked with trying to figure out why a query that normally executes in a few hundred milliseconds sometimes takes ten times longer to run and is affecting the performance of the application.  I understand that their maybe many different causes for this problem, but being a novice at web services and SQL server I really do not even know where to start or what to look for.  I'm hoping that if I present the problem some experts out there might be at least able to tell me how to tackle this problem.

The application is a line-of-business application written in Silverlight and using RIA Services/Entity Framework to access a MSSQL Server database.  The SQL server and IIS are running on separate virtual machines and both servers are barely stressed in terms of memory and processor utilization.   The application is only used by a handful of users, however, they have been complaining that operations that take a second or less to do occasionally take ten or more seconds to perform.  To track down this issue we added some logging code to the Silverlight client application that logged every database request.  We then used the application for a four hour period after normal business hours when no other users would be on the system to see what the database response times were.  We came up with an interesting plot:

The plot represents four hours of usage along the horizontal axis with each marker representing a database operation. The vertical axis represents the time it took (in milliseconds) to perform that operation. The plot clearly indicates that the vast majority of the operations happen in less than two seconds with some of these even loading hundreds or thousands of entities. The long running operations (5 seconds or more) are interestingly enough being caused by a single query statement. This query statement is called every 15 seconds to poll the database for changes on a single entity; the query looks like this:

Context.Load<Visit>(
    from e in Context.GetVisitsQuery(Visit_Includes)
    where e.IsAppointment && e.Timestamp > _lastVisitTimestamp
    || (e.TreatmentID != null && e.Treatment.Timestamp > _lastTreatmentTimestamp)
    select e, LoadBehavior.MergeIntoCurrent,
    LoadVisitCallback, null);
During the four hour test, 660 calls were made to this query and 415 completed in less than 300 milliseconds, however, the remaining completed anywhere from 300 milliseconds to 60,000 milliseconds as can be seen in the plot.  So why the big discrepancy?  Was it the number of entities returned by the query?  Nope!  All the queries returned ZERO entities.  This is the point where I'm baffled.  I don't understand why the same query executes with such different times when returning an empty result set AND being executed on an idle server.  Can anyone give me some clues on where to start looking next or what tools or methods I could use to investigate this more deeply?  Part of the difficulty with debugging this is that it appears random and most of the time it works as expected. 
 

ADDITIONAL INFO 8/8/2014:

Per Vinay's suggestion I was able to run SQL Profiler on the server for a 24 hour period; I only recorded those queries that took more than 500 milliseconds to execute.  The times of the queries is shown below.  There are a few things I can take away from this plot: (1) for the large number of queries that get executed against the server, the vast majority run better than 500 milliseconds, (2) None of the queries recorded took more than 2100 milliseconds.  What I couldn't seem to gather from the Profiler was how many results/entities the query actually returned.  Nonetheless, the plot does appear to show that the SQL Server is not the bottleneck as it cannot explain the queries shown above that take 10 or more seconds to execute.

 Looking for help on where to go from here.

 

 

 

 

 

 


Viewing all 362 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>