WCF / ASMX :: Linq To SQL Web Service Cannot Be Serialized?
Feb 6, 2010
I'm playing around with Web Services using Linq to SQl. I apparently have a lot of learning to do. What I'm trying to do below is pull data from the Northwind db Employee Table. I don't need to see the whole table, I'm just trying to select individual(s) but I keep getting the following error
"System.Data.Linq.Binary cannot be serialized because it does not have a parameterless constructor"
Code Below:
<WebMethod()> _
Public
Function EmployeeInfo()
As List(Of Employee)
Dim db
As
New NorthwindDataContext()
Dim output =
From cust
In db.Employees _
Select cust.EmployeeID, cust.FirstName, cust.LastName
Return output
End
Function
View 7 Replies
Similar Messages:
May 5, 2010
if i have the web application with many pages like add order page, edit order page, and delete order page actually they also interact with the Sql Server 2008 and i also create web service page call Sales_Service.asmx. i know just i need to put something like query into Web Method in Sales_Service.asmx but i have a lot of queries, i don't know which query i should put into it and how the web page call the Sales_Services.asmx
View 2 Replies
Nov 8, 2010
A customer reported that our asmx web service is continually increasing in memory (mem usage as well as private bytes). We are able to reproduce the problem in our lab with Windows 2003 Server SP2 (fully patched) on some of the machines. The customer is using Windows 2008.
We created a Hello World web service targeting the 2.0 framework built under VS2005 SP1 and a test client that continues to call it. The memory increases steadily - approximately 40K per client request. If the test app is paused, the memory remains the same. When it is closed, the memory drops. Explicit calling of GC.Collect does not drop the memory.
We have run the memory profiler on the service and the leak is all native memory. We have uninstalled/re-installed the Framework on one of the machines but no difference. To our knowledge all of the security and IIS settings are not modified. We have compared app pool, default web site and virtual directory properties to machines that have no problem and they are identical.
View 11 Replies
Mar 17, 2011
I have a .net app developed in .net 4.0 version. And I implemented an asmx web service in this. Now I want to call one of the webservice method in another classis ASP application java script function.
View 2 Replies
Mar 28, 2011
Is it possible to run a web service as a particular user/service account in the same way a Windows service can?I have a service account used for connecting to the DB and want to run the webservice under this account as the users using the webservice won't have DB access.The way I see to do it is to include the Impersonate option in the Web.config file, but is there any better way to do this?
View 1 Replies
Mar 17, 2011
How to create an instance of web service without adding web service reference? How to identify the server address/name where the web service is hosted from C# code?
View 1 Replies
May 25, 2010
My WCF Client calls my WCF Service which then calls ASMX Web Service. The problem is i have configured my wcf client and wcf service to windows credentials type but when wcf service calls asmx service the user credentials (default windowsidentity) is not passed to asmx service.
In WCF Service i am able to get user identity by using : Thread.CurrentPrincipal.Identity.Name;
WCF Service - i have disabled anonymous access and enabled windows authentication. ASMX Web Service - i have disabled anonymous access and enabled windows authentication.
WCF Service Config
[Code]....
View 1 Replies
Aug 4, 2010
i have created a normal web service and i want to host it outside IIS. one idea i got is to use window service as hosting environment. i have created a web service and hosted it window service and its window service is running now.would anybody please let me know that how can i call web service hosted in window service binded over soap.tcp. here is my sample code.
[Code]....
[Code]....
View 1 Replies
May 26, 2010
I want to develop a web service that handle another web service's event. (C#.Net 3.5 framework)
View 1 Replies
Feb 10, 2011
I'm currently trying to work out the best way to build this web application, which will then be intergrated on other systems, such as WinForms, Intranets etc.
We hope to include the usual layers i.e. DAL, BLL, BOL and UI but I have been experimenting with Entity Framework 4 and WCF Data Services and managed to get something in place where I was using WCF as a gateway to EF4.
i.e. Adding a Service Reference to my project and then using the EF4 context and writing LINQ queries against the DB
e.g.[Code]....
Now with the current setup I would still need to write a DAL Class Library, that interacts with the Data Service, because as I said WCF Data Services only seems to be a gateway, I can't see where to put the code (above) in the Data Service and then how I could these methods.
My questions are: 1. How do I develop a WCF Data Service in such a way to allow this behaviour - I know how I could do it using ASMX web service, something like [Code]....
2. If I am to use WCF Data Services, how is serialization handled (if at all) - again I know how to do something in ASMX web services
3. Again, If I am to use WCF, how do I add Security and only allow my applications to access the web service - for obvious reasons
4. Would it be possible / logical to also include the Business Logic Layer into the web service?
View 4 Replies
Aug 30, 2010
How to create simple web service in VS2010 Professional (trial version). There is no template to do this. I am not trying to create WCF service here.
View 2 Replies
Sep 20, 2010
I have running existing web service in framework 2.0, but i want to convert all my service to framework 3.5 WCF Service..
View 1 Replies
Feb 7, 2011
How do I add the WCF service built using VS2010 as a service reference to a Winforms app which is written in VB6?
View 1 Replies
Feb 2, 2011
I am keep getting an error that "Service Error : wbsTest failed" where wbsTest is my webservice.
The error comes up frequently enough for the user - normally reproducible within a minute or so of working with an application.
A bit of background: An user is a remote user accessing application hosted on our servers over https. He is software firewalled and his connection isn't the fastest but it is responsive enough. When errors do not present themselves, page loads are fairly quick.
View 8 Replies
May 24, 2010
I want to access simple web service inside WCF service. How can i achieve it?
View 2 Replies
Jun 17, 2010
I am writing a program to measure the latency(response round trip time) for a web service. I need to have this at client side.
My initial plan is to store the time at which request is sent and then calculate the difference in time when we recieve a response from the web service. Is this the correct way to measure latency of web service. This has some overhead because of storing time and all. How can this be done?
Another option is to attach a timestamp with the SOAP request. But the server should return the timestamp. This will not be possible in case of third party web services.
View 4 Replies
Mar 29, 2011
I have an issue with deserializing an object. I get an error 'System.Int32' cannot be converted to type 'System.Decimal'. This object has many child objects and since this object has been serialized, a new version of the object has one or many fields that have been changed from int to decimal and now I can't deserialize the object because it doesn't match my original object.
I have tried using the OnDeserializing method but the context parameter.
Is there a way around this? I've found some examples online but it doesn't really apply to my situation. I would just like to know if there is a way to view my serialized object even if my object has now changed or if there is a way to find out which variable needs to be changed to decimal and how to go about doing it.
I've added your code but I'm not quite sure how to call it from my code. Here's what I've got:
public static Application LoadSnapshot(int appID, int statusID)
{
ApplicationSnapshotCollection AppSnap = new ApplicationSnapshotCollection();
AppSnap.LoadByAppAndSnapshotStatusID(appID, statusID);
[Code]....
How do I go about calling the constructor with the proper parameters in my scenario?
View 1 Replies
Mar 10, 2011
i have been going through the documentation of viewstate. [URL]It was mentioned that objects that can be serialized are stored in viewstate. What is the meaning of serializing of objects ??
View 2 Replies
Mar 29, 2011
I have an issue with deserializing an object. I get an error 'System.Int32' cannot be converted to type 'System.Decimal'. This object has many child objects and since this object has been serialized, a new version of the object has one or many fields that have been changed to decimal and now I can't open or view the object because it doesn't match my original object. Is there a way around this? I've found some examples online but it doesn't really apply to my situation. I would post some code but I don't think it would really help...I would just like to know if there is a way to view my serialized object even if my object has now changed and how to go about doing it.
View 2 Replies
Jan 2, 2011
I have a table in my SQL Server DB that holds auditing information for certain actions a user takes within my system. Things like who performed the action, when it was performed, and what action are all pieces of information that can easily span multiple actions. But depending on the action performed, there may be other information that I want to capture, that is specific to the action. To handle this, I elected to add an "XML Metadata" column to the table that holds serialized XML of different metadata objects that I've created. I created a metadata object for each of the actions that I'm interested in tracking extra for. So each object is responsible for tracking specific extra information (metadata) for it's action. The objects are serialized and written to my new column.
I have SystemAction objects that I use to store information from this table, and I've added a string field that holds the XML string from the DB. The problem is, when I'm reading this XML back from the SystemAction objects, I'm struggling with a way to generically translate it back into it's correct metadata object. Each metadata object is going to have different fields, and each object has it's own static method that takes an XML string and attempts to return the metadata object type. So I could say:
SomeActionMetadata mdObj = SomeActionMetadata.BuildFromXML(xmlStringFromDB);
But I really don't know of a way to say "Here's some XML that could translate to any number of different objects. Figure it out and give me the right object back."
Given my current implementation, I could always just assign a unique ID to each metadata object that is stored as a field in each object, then use a case statement to switch on that ID and use the appropriate class's static build method to build the right object. But I was hoping for something a little more automatic than that. What if I have a List of SystemAction objects and just want to loop through them and generate the correct metadata object type?
View 1 Replies
Oct 13, 2010
I have a ListBox on my page. I'm making an AJAX call to a C# function, and I need to pass the values of the selected items. Here's what I have:
$('#btnSubmit').click(function() {
$.ajax({
type: "POST",
url: 'Default.aspx/GetSelectedValues',
data: '{selectedValues: ' + $('#lbItems').serialize() + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess
});
});
<select id="lbItems" multiple="multiple">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
<option value="5">Five</option>
</select>
[System.Web.Services.WebMethod]
public static string GetSelectedValues(string selectedValues)
{
//
}
The data being passed to the C# function looks like:
lbItems=1&lbItems=3&lbItems=5
Is there any built-in C# function that can deserialize that easily, to convert the values into an array of some sort? Or maybe there's a better way to pass the data from jQuery?
View 3 Replies
Mar 10, 2011
I was trying to go through this tutorial:
[URL]
but when I tried to add the service reference to the silverlight app, the Add Service Reference window would show me that there was a service file, but the node wouldn't expand to show the rest of the files that contain the services and what not. I got this error instead:
"An error occurred during the processing of a configuration file required to service this request. review the specific error details below and modify your configuration file appropriately."
"Parser Error Message:There is no service behavior named 'AdventureWorks_WebServer.Service1Behavior'."
"Metadata contains a reference that cannot be resolved: 'http://localhost:55579/Service1.svc'.
The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
If the service is defined in the current solution, try building the solution and adding the service reference again."
here's my web.config file:
[Code]....
View 1 Replies
Aug 1, 2010
I have a serialized object which needs to be sent as an encrypted XML string. I am able to save the serialized object to a well-formed XML file, but this is not what I want. I have already got Rijndael encrypt/decrypt working for a sample string.
Person person = new Person("Irish", "Chieftain");
XmlSerializer xmlSerializer = new XmlSerializer(typeof(Person));
// Write serialized XML to file
System.Guid guid = System.Guid.NewGuid();
[Code]....
View 1 Replies
Jul 17, 2010
i want to know how to use the web services in asp.net project
View 1 Replies
Feb 11, 2011
I'm just getting started with WCF services and I want to ask you if you could tell me where a WCF service runs.As far as I have researched a WCF service works as a server-side application (under IIS).I believe it works a similar way to a servlet in Tomcat.
View 3 Replies