Quantcast
Channel: WCF Data Services forum
Viewing all 877 articles
Browse latest View live

The underlying connection was closed: The connection was closed unexpectedly. WCF data service and Sql Azure

$
0
0
Hi all,

I am getting following exception in _datacontext.savechanges();

The underlying connection was closed: The connection was closed unexpectedly.

I am using wcf data service and sql azure and that wcf data sevice create the role in azure.

now i am getting above exception not regular but some times so my code work some time i didnot understant what problem occurred so i got this error message. i am sure that connection is not closed but still it says connection was closed.

Moved Thread: Entity Framework and Spatial Types

$
0
0

Raymond Saltrelli originally asked this question on the pre-release forums; moving it here for visibility:

"Is there any plan to add support for the new Entity Framework spatial types to WCF Data Services?  It was really nice when they added them to EF in the June 2011 CTP so now I can manipulate them server side but I would also like to be able send some kind of representation to the client.

Is there a work around for this in the mean time?  I tried to use the IgnoreProperties attribute on my Geometry property and add a GeometryAsBase64String property but apparently IgnoreProperties doesn't work with EF.  What alternatives to EF do I have if I want to use spatial types with WCF Data Services?"

ws-federation active requestor profile

$
0
0
Does any of windows product uses ws-federation active requestor profile as client for authentication/auhorization. I am planing to implement a IP which implement active profile so that I can test it with mincosoft product.

How to perform batch processing in Odata,, I am expecting how to fit this in code(c# or wcf 5.0)

$
0
0

How to perform batch processing in Odata,, I am expecting how to fit this in code(c# or wcf 5.0)

 we know that batch is for multiple operations in a single call.

 There is good information about Odata batch process in

 http://www.odata.org/documentation/batch

http://www.odata.org/media/30002/OData%20Batch%20Processing%20Format.html

--batch_36522ad7-fc75-4b56-8c71-56071383e77b

Content-Type: application/http

Content-Transfer-Encoding:binary

GET /service/Customers('ALFKI')

Host: host

--batch_36522ad7-fc75-4b56-8c71-56071383e77b

Content-Type: multipart/mixed; boundary=changeset_77162fcd-b8da-41ac-a9f8-9357efbbd621

Content-Length: ###      

--changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621)

Content-Type: application/http

Content-Transfer-Encoding: binary

POST /service/Customers HTTP/1.1

Host: host 

Content-Type: application/atom+xml;type=entry

Content-Length: ###

<AtomPub representation of a new Customer>

--changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621)

Content-Type: application/http

Content-Transfer-Encoding:binary

PUT /service/Customers('ALFKI') HTTP/1.1

Host: host

Content-Type: application/json

If-Match: xxxxx

Content-Length: ###

<JSON representation of Customer ALFKI>

--changeset(77162fcd-b8da-41ac-a9f8-9357efbbd621)--

--batch(36522ad7-fc75-4b56-8c71-56071383e77b)

Content-Type: application/http

Content-Transfer-Encoding:binary

GET service/Products HTTP/1.1

Host: host

--batch(36522ad7-fc75-4b56-8c71-56071383e77b)--

How to implement it, please help on this



Best Regards Showkath

clientaccesspolicy.xml + IIS = not working

$
0
0

Hi,

I've created a simple WCF Data Service. I've added a clientaccesspolicy.xml file. I've created a SL app in the same solution and pointed at the service which runs on casini and all is great. But when I've moved the service to IIS SL cannot communicate with it anymore. The clientaccesspolicy.xml is in the root of the web and it's accessible anonymously with no problem. What may be the issue?

Dynamic oData server

$
0
0

Hello,

I am in the need of creating dynamic oData server. It's easy to implement static by using Entity Framework and WCF Data services. Right now there are one foreign process, which creates some tables in DB and I want my oData server to expose these newly created and filled tables after the process has finished. If needed, I can modify that process to set up some configuration options or something. To clarify my question, I provide you with some pseudocode, which I want to implement if possible:

Dim em as EntityModel
Dim infoData as DataTable = GetInfoData() // Information about Entities I want to create

for each row as DataRow in infoData.Rows

Dim Ent as Entity = em.CreateNewEntity(row("EntityName")) // Create this entity
Dim ColData as DataTable = GetColData (row("EntityId")) // Information about entity columns I want to create

for each colInfo as DataRow in ColData.Rows

Ent.AddProperty (colInfo("ColName"), colInfo("ColType")) // Add columns to Entity

next for

Dim data as DataTable = GetData(row("EntityId")) // Not sure if this part is needed, becasue here I can bind to view or procedure or some other data from DB

Ent.DataSource = data
em.AddEntity(Ent) // Add newly created Entity to DataModel

next for


looking for a tutorial using WCF

$
0
0

I'm looking for a tutorial that will show me how to accomplish the following:

1. create the WCF service

2. connect to SQL 2008

3. Pull data out using LINQ

4. execute business logic from the results

the purpose is, I need to create a process that will be kicked off by sharepoint (non issue here), that will pull data, compare records and send emails out. I'm looking to do this via a WCF service due to it may be shared by other processes in the future.

Is there something out there or is it a mix bag?

Wcf service without entity frame work and output in json format..!!

$
0
0

Hi all

I am new to this wcf service and found some helpful article from internet, but all shown how to create a service using entity framework and retrieved data in atom, json format.

But am trying to create the service without entity framework manager and wanna pull the data in json format and in the mean i wanna input the data from the web page text boxes into the database.


OData for multiple data sources

$
0
0

I have an Odata service servicing multiple database. At the time of connection, you can specify the database name and then we will service requests for that database.

For example

MyService serv = new MyService("<URL>.svc/<Database>");

After this, I can do
Customer c = serv.Customers.Where(c => c.Id == 1);
and it works fine.

But when I do
c.Name = "NewName"
serv.UpdateObject(c);
serv.SaveChanges()

The URL I get in the Request object on the server has
<URL>.svc/Customer('1')

instead of
<URL>.svc/<Database>/Customer('1')

It works fine for Insert i.e. AddObject but not for updates.

Can you please help out?


Naveed Zafar

Expand not working as expected

$
0
0

Hi,

here is the quick setup:

- desktop application connected to WCF Data Service

- 3 tables: T1, T2, T3

- T2 has FK that references T1

- T2 has FK that references T3

We are trying to use the following expand:

...

from r in proxy.T1.Expand("T2/T3") where r.ID = 100

...

This expand returns different number of rows in T2 than expected.

If we do not include T3 like this:

...

from r in proxy.T1.Expand("T2") where r.ID = 100

...

we receive proper number of T2 rows back. Also, when we run SQL directly everything looks good.

 

Do you have any idea what is going on here? This is extremely urgent and any help is appreciated.

 

Thanks,

 

PV

 

DataSvcUtil - getting error 0063: Precision facet not supported for data type of String

$
0
0

Whenever I attempt to run DataSvcUtil against a Data Service (version 5.0 of WCF Data Services), the proxy generation fails with the error message:

error 7001: Schema specified is not valid. Errors:
(0,0) : error 0063: Precision facet isn't allowed for properties of type String.

Any ideas? The Data Service is built using VS2012, Entity Framework 5.0 and WCF Data Services 5.0. Client is a WPF client built using VS2012. I have tried adding a service reference, as well as directly using DataSvcUtil to generate the CSharp file. Both methods give the same error.

WCF client exception: The parameters dictionary contains a null entry for parameter 'key' thrown when SaveChanges() called

$
0
0

Hi,

I am using WCF Data Services Client to connect to a Web API OData service.  When querying or inserting data, there is no error.  If I modify a tracked object via DeleteObject() or ModifyObject() and then SaveChanges(), the error below is thrown.  I can delete from the service using Fiddler [http://localhost:51871/odata/Unit2(861)] with a DELETE verb, and the service works as expected. 

Any help is appreciated.

<?xml version="1.0" encoding="utf-8"?>
<m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
  <m:code />
  <m:message xml:lang="en-US">The request is invalid.</m:message>
  <m:innererror>
    <m:message>The parameters dictionary contains a null entry for parameter 'key' of non-nullable type 'System.Int32' for method 'System.Net.Http.HttpResponseMessage DeleteUnit(Int32)' in 'xxAPI.Controllers.Unit2Controller'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.</m:message>
    <m:type></m:type>
    <m:stacktrace></m:stacktrace>
  </m:innererror>
</m:error>

EDIT:

It appears this has something to do with the property names of the POCO class that controller manages.  Changing the Id property (which is not the primary key) to a new name like Idx fixes the problem.  Also changing the Id property type from string to int fixes the problem.  So now the question is: How do I tell WCF to stop trying to use Id as the primary key?

    [DataServiceKey("UnitKey")]
    public partial class Unit
    {
        public string Idx { get; set; }
        public string Name { get; set; }
        public string IsActive { get; set; }
        public string IsDefault { get; set; }
        public int    UnitKey { get; set; }
    }




The best OData select wizard - EVER!

$
0
0

Hi all;

We're shipping version 12 now which includes support for OData. And it has a really good wizard for crafting request URLs. It uses the metadata to make it a drag and drop operation. You can take a look at it atOData Reporting.

We've also extended the URI spec a bit (obviously only when using our system). You can do .../Company.Contact.Address.City where Contact and Address are complex properties and you want just the string for the city property.

And thank you to all here that helped me write this by answering all my questions.


Who will win The Windward International Collegiate Programming Championships?

WCF Data services - Cannot find DataServiceQueryContinuation class

$
0
0
I've developed some client code using WCF Data Services, and it works perfect in Windows 7.  It uses the DataServicesContinuation class for server side paged results (System.Data.Services.Client dll).

When my client tries to compile the code in Windows Vista, it fails, saying that the "DataServicesContinuation class does not exist, are you missing an assembly".  He is telling me his System.Data.Services.Client dll does not have this class. 

Two questions:

1) Is it possible to get paged results from a WCF Data Service without using this class

2) The website says it is supported in Vista, but it seems not to be (http://msdn.microsoft.com/en-us/library/ee474245(v=vs.90).aspx)   There is a conflicting article saying it is supported maybe only in Windows 7?  (http://support.microsoft.com/?kbid=976127&wa=wsignin1.0)

Thanks, any advice on how to proceed would be helpful.

- Josh P

I can't log in from the client side using WCF data service

$
0
0

Hey everyone, 

i've been struggling with this issue for 3 days now.. i'm working with some colleagues in a training and this issue is making my work on stand by. let me explain to you the situation WCF Data services experts. 

I have a web application forms hosted in IIS express, this app contains a wcf data service, and a model, this app is connected a database sql server 2012 express. in the other side i have a web application forms as a client consumer of the service. well the client must log in and do some operations like add users, other stuff.. but before they must to log in. 

When i execute the client app and insert username/pass an webexception is thrown in the line: WebResponse res = request.GetResponse();

heres the code of the log in button: 

GlobalVariables.ctx = new XpoContext(GlobalVariables.serviceRootUri);
GlobalVariables.ctx.Credentials = new NetworkCredential(UserName.Text, UserPass.Text);
var res = GlobalVariables.ctx.GestionRestaurant_v3_Site.FirstOrDefault();
FormsAuthentication.RedirectFromLoginPage(UserName.Text, Persist.Checked);

in the web app i have a class XpoContext: 

as i've mentionned before, the web application are hosted in IIS Express, i've created the virtual directory and copied/pasted the link in the xpocontext 

namespaceKSclient.ServiceReference1
{
   
publicpartialclassXpoContext
   
{

       
partialvoidOnContextCreated()
       
{
           
this.SendingRequest+=newEventHandler<SendingRequestEventArgs>(OnSendingRequestManualCookies);
       
}

       
//Using Manual Approach to Getting and Setting Cookies:
       
voidOnSendingRequestManualCookies(object sender,SendingRequestEventArgs e)
       
{
           
NetworkCredential creds =this.CredentialsasNetworkCredential;
           
string cookie =GetCookie(creds.UserName, creds.Password);
            e
.RequestHeaders.Add("Cookie", cookie);
       
}

       
string _cookie;
       
privatestringGetCookie(string username,string password)
       
{
           
if(_cookie ==null)
           
{
               
string loginServiceAddress =
                   
string.Format("{0}/{1}/{2}",
                   
"http://localhost:27796",
                   
"Authentication_JSON_AppService.axd",
                   
"Login");
               
string body ="";
               
WebRequest request =
                   
CreateAuthRequest(username, password, loginServiceAddress,out body);
               
Stream stream = request.GetRequestStream();
               
StreamWriter sw =newStreamWriter(stream);
                sw
.Write(body);
                sw
.Close();
               
WebResponse res = request.GetResponse();
               
if(res.Headers["Set-Cookie"]!=null)
               
{
                    _cookie
= res.Headers["Set-Cookie"];
               
}
               
else
               
{
                   
thrownewSecurityException("Invalid username and password");
               
}
           
}
           
return _cookie;
       
}
       
privatestaticWebRequestCreateAuthRequest(string username,string password,string loginServiceAddress,outstring body)
       
{
           
WebRequest request =HttpWebRequest.Create(loginServiceAddress);
            request
.Method="POST";
            request
.ContentType="application/json";
            body
=string.Format(
               
"{{ \"userName\": \"{0}\", \"password\": \"{1}\", \"createPersistentCookie\":false}}",
                username
,
                password
);
            request
.ContentLength= body.Length;
           
return request;
       
}




   
}
}


thank you for reading


WCF Certificate-based Authentication Issue

$
0
0

Hey everyone,
We have a WCF Service which enabled certificate-based authentication. This is hosted on IIS 7.0 with Windows Server 2008 64-bit Service Pack 2 (on sever A).

This service is then consumed by an ASP.NET Web Client Application, which is hosted on IIS 6.0 with Windows Server 2003 Service Pack 2 (on Server B).

We have two environments.
1. Dev: Web Server (2003 server 32-bit), App Server (2008 server, 64-bit) with x509 certificate-based authentication enabled WCF Service was hosted
2. Test: Web Server (2003 server 32-bit), App Server (2008 server, 64-bit) with x509 certificate-based authentication enabled WCF Service was hosted

Both environments were working fine until last week. Our Test environment stopped working with the following exception from WCF Service when running a WCF-based Client Server Communication Application. Below is a snippet of an exception we received:

System.InvalidProgramException: Common Language Runtime detected an invalid program.
at System.ServiceModel.Dispatcher.ClientRuntime..ctor(String contractName, String contractNamespace)
at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection&amp; parameters)
at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint, Boolean useActiveAutoClose)
at System.ServiceModel.ChannelFactory.CreateFactory()
at System.ServiceModel.ChannelFactory.OnOpening()
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open()
at System.ServiceModel.ChannelFactory.EnsureOpened()
at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via)
at System.ServiceModel.ChannelFactory`1.CreateChannel()
at System.ServiceModel.ClientBase`1.CreateChannel()
at System.ServiceModel.ClientBase`1.CreateChannelInternal()
at System.ServiceModel.ClientBase`1.get_Channel()
at AxMsseService.SecretQuestionsClient.GetSecretQuestions()
at sitename.appname.Customer.Web.test_Default.SetSecretQuestions()
Message Date:4/15/2013 12:58:32 PM

We noticed the test server was updated with patches that week. Based on the error info, we did some research and found some cases with similar issues based on patch applied. (MS Support Article ID: 2742595)

We applied the patch resolution given by Microsoft (installed Hotfix 2537715) and ran PEVerify against all the DLLs, resulting in no exception. (MS Support Article ID: 312544)
To replicate the error, we brought Dev environment to the same patch level as Test, without any errors.

We are still experiencing the same error from Test environment as the Dev environment's working good.

Had anyone ever ran into this issue? Any insights on what could cause this problem we are having? If yes, what resolutions were taken to resolve this type of issue?

Your feedback and/or advice would greatly help us understand what we are dealing with.

Thanks in advance.

WCF The underlying connection was closed: The connection was closed unexpectedly.

$
0
0

Hi,

When I try to connect to my WCF service, I get the following error. It happens only when I try to pass a complex DataContract. When passing simple value types it works fine. I'm using 4.5 and my complex type is marked with DataContract and DataMember attributes.

I even tried marking the DataMember(IsRequired=true) and also setting the timeout. No use.

Service has a single basicHttpBinding.

What would the cause for this problem ? And how can I solve it.


My blog : http://thuruinhttp.wordpress.com

WCF 4.5 - The underlying connection was closed: The connection was closed unexpectedly.

$
0
0

Hi,

When I try to connect to my WCF service, I get the following error. It happens only when I try to pass a complex DataContract. When passing simple value types it works fine. I'm using 4.5 and my complex type is marked with DataContract and DataMember attributes.

I even tried marking the DataMember(IsRequired=true) and also setting the timeout. No use.

Service has a single basicHttpBinding.

What would the cause for this problem ? And how can I solve it


My blog : http://thuruinhttp.wordpress.com

WCF web service stopped working with SSL on localhost

$
0
0
 

Hi All,

I know this question has been beaten to death, but my problem is not quite as simple.

My web service was working under SSL on localhost, but then it suddenly stopped and I have no idea why.

I can see the WSDL information in the web browser, but when I try to call a method I get the error: The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via

Below is my web.config extract.


<system.serviceModel><serviceHostingEnvironment multipleSiteBindingsEnabled="true" /><services><service behaviorConfiguration="serviceBehavior" name="WebService.Service"><endpoint
          address="mex"
          binding="mexHttpsBinding"
          contract="IMetadataExchange"/><endpoint name="PheSsoWebService.PheSsoService"
          address=""
          binding="basicHttpBinding"
          bindingConfiguration="secureHttpBinding"
          contract="WebService.IService" /><host><baseAddresses><add baseAddress="https://localhost/WebService" /></baseAddresses></host></service></services><bindings><basicHttpBinding><binding name="secureHttpBinding"><security mode="Transport"><transport clientCredentialType="None" /></security></binding></basicHttpBinding></bindings><behaviors><serviceBehaviors><behavior name="serviceBehavior"><serviceMetadata httpsGetEnabled="true" /><serviceDebug includeExceptionDetailInFaults="true"/></behavior></serviceBehaviors></behaviors></system.serviceModel>


If anyone has any insight into this please let me know.

Thanks in advance.

Lee


Calling a Stored Procedure from Silverlight

$
0
0

I created an Entity Data Model for a database and added a function import for a stored procedure that returns a complex type.  Then I created a WCF Data Service to expose the Entity Data Model.  Next I added a Service Reference to my Silverlight application for the WCF Data Service.

I can see the stored procedure and the complex type it returns in the Entity Data Model Designer but I can't find it in the Silverlight service reference.  All the table entities show up and are accessible in IE but not the stored procedure.

I have tried all the suggestions I can find including one in this forum that suggested unchecking the "Reuse Types in referenced assemblies" on the Advanced page of Add Service Reference.

Apparently, I have missed something in creating my WCF Data Service or the Silverlight service reference.

Would you please give me information about what I have done wrong or am not doing?

Thanks,
Tom


TomBean


Viewing all 877 articles
Browse latest View live


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