it may sound a bit newbish question.We have a web service that comunicates with the database and exposes web methods that enables the application to access the database. Each method does only one operation (Insert, Update or Delete). What I need to do is create a transaction that will be consisted of multiple calls to the database, meaning multiple calls of more then one web methods. Can I do that? (I read that if the web method does not throw exception - or ContextUtil.SetAbort() is not called - the transaction will be commited automatically when the web method finishes executing, which I don't want to happen because I want to call another web method in the same transaction, and then manually commit the transaction)
We have a common WCF service Which takes stored procedure name and value as parameters from .ASPx page and execute in Database. In some cases, We need to execute 3-4 stored procedure in Sequence. Here, If any stored procedure fails then we need to rollback. How can we implement Transaction with WCF service.
I am creating entries in a contract table using linq to sql.
One column needs to conditionally be assigned an application number from a range of values.
I'd like to simply increment the max existing value, however it is a multi-user application and I'm concerned about multiple contracts receiving the same app number if they happen too close together.
Is there a way to either force the entire thing to use the same transaction, or to execute both during the same submit?
I was trying to overload two web methods by adding the MessagName descriptor.
[WebMethod(MessageName = "GetFiles")] public [Code]....
But I am getting the following Server Error
Server Error in '/Test.Service' Application.
Service 'TestService' does not conform to WS-I Basic Profile v1.1. Please examine each of the normative statement violations below. To turn off conformance check set the ConformanceClaims property on corresponding WebServiceBinding attribute to WsiClaims.None.R2304: Operation name overloading in a wsdl:portType is disallowed by the Profile. A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes. Note that this requirement applies only to the wsdl:operations within a given wsdl:portType. A wsdl:portType may have wsdl:operations with names that are the same as those found in other wsdl:portTypes.
- Operation 'GetFiles' on portType 'TestServiceSoap' from namespace 'http://www.Test.com'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Service 'TestService' does not conform to WS-I Basic Profile v1.1. Please examine each of the normative statement violations below. To turn off conformance check set the ConformanceClaims property on corresponding WebServiceBinding attribute to WsiClaims.None.R2304: Operation name overloading in a wsdl:portType is disallowed by the Profile. A wsdl:portType in a DESCRIPTION MUST have operations with distinct values for their name attributes. Note that this requirement applies only to the wsdl:operations within a given wsdl:portType. A wsdl:portType may have wsdl:operations with names that are the same as those found in other wsdl:portTypes.
- Operation 'GetnFiles' on portType 'TestServiceSoap' from namespace 'http://www.test.com'.
To make service conformant please make sure that all web methods belonging to the same binding have unique names.
I have an ASP.NET 3.5 web application that uses ASMX web services that are called synchronously. I want to see if I can call them asynchronously because some of the web methods take a long time to process and I'm concerned that this is affecting scalability.
I found this article that explains how to use Asychronous web methods, from 2002: http://msdn.microsoft.com/en-us/library/aa480516.aspx. It says:
For asynchronous requests, during reflection the ASMX handler looks for Web methods with a certain kind of signature that it recognizes as being asynchronous. In particular, it looks for a pair of methods that have the following rules:
There is a BeginXXX and EndXXX Web method where XXX is any string that represents the name of the method you want to expose. The BeginXXX function returns an IAsyncResult interface and takes as its last two input parameters an AsyncCallback, and an object respectively. The EndXXX function takes as its only parameter an IAsyncResult interface. Both must be flagged with the WebMethod attribute. When I create the reference to my web service, I don't see any BeginXXX and EndXXX methods. I only see a XXXAsynch method and the article doesn't mention that method. I've done further research and every other article I've found also mentions the BeginXXX and EndXXX web methods.
On my local machine with the default ASP web server I am able to browse my web service's methods, which have with prompts and an invoke button.But when I deploy this same code to an IIS server and I browse the asmx page I just get a descritpion of the methods.
I am using GetMethods() method to get the list of all the available methods in WCF. But it returns everything, how can I only show the methods that I exposed to client.
[Code]....
How can I filter the methods only to WCF Servicecontracts?
given a url that references an asmx how would i go about displaying all of their method names? if assembly="http://.../something/something.asmx" and i was trying to display the method names of that service what should i do now that i have gotten myself this far? i cant seem to find a solution among the hundreds of examples ive looked at
public TestReflection(string assembly) { Assembly testAssembly = Assembly.LoadFrom(assembly);[code]....
What is the best way for authenticating web methods in a web service? Is it right having authentication for every web method and verify user name and password for each web method? Is there a way to authenticate just once not for every web method? something like using sessions and etc?
I've got all of my ASP.NET requests wrapped in a Session and a Transaction that gets commited only at the very end of the request. At some point during execution of the request, I would like to insert an object and make it visible to other potential threads - i.e. split the insertion into a new transaction, commit that transaction, and move on. The reason is that the request in question hits an API that then chain hits another one of my pages (near-synchronously) to let me know that it processed, and thus double submits a transaction record, because the original request had not yet finished, and thus not committed the transaction record.
So I've tried wrapping the insertion code with a new SessionScope, TransactionScope(TransactionMode.New), combination of both, flushing everything manually, etc. However, when I call Refresh on the object I'm still getting the old object state. Here's some code sample for what I'm seeing:
Post outsidePost = Post.Find(id); // status of this post is Status.Old using (TransactionScope transaction = new TransactionScope(TransactionMode.New)) { Post p = Post.Find(id); p.Status = Status.New; // new status set here p.Update(); SessionScope.Current.Flush(); transaction.Flush(); transaction.VoteCommit(); } outsidePost.Refresh(); // refresh doesn't get the new status, status is still Status.Old
I have some WCF services that I want to return in different formats based on a querystring param. For example, [URL], [URL], [URL], etc... This would make it so that many different types of clients could consume the services whichever way was easiest for them, such as binary for a .NET client and json for an ajax or Flex client.
What I'm thinking is that I can have the WCF web methods return their .NET business objects and not worry about the output mode and then have a behavior that hooks in after returning from the web method which checks the querystring for this param and either:
1. Continues returning the business objects if the mode is dotnet.
2. Converts the business objects to xml if the mode is xml and returns a string of xml.
3. Converts the business objects to json if the mode is json and returns a string of json.
I have an ASMX Web Service set up to use the HTTP GET method. Simple methods which take basic String and Int parameters are working ok, and I can call MyService.asmx/MethodName?Param=Value and get a response back in XML.
However, when I have a method which has a nullable Int (i.e. int?), I get this error:
< Method Name > Web Service method name is not valid.
The error message is confusing, as the method does exist, just not in the GET scope. I presume this is because a nullable type is too complex to be passed via the URL, but I can't find any documentation or SO posts on this.
I appreciate that complex types like Lists or custom classes etc will not work using GET, but I would have assumed that a simple nullable int or nullable datetime could be handled natively, simply by detecting whether it was omitted from the URL. Guess it's not that simple!
which is better approach from performance point of view, is it better to use one web-service method to load data by passing Database Table name and keys or is it better to use separate method for each database table! knowing that i'm using .net asmx through ajax requests.it's obvious that one method is better from OO perspective since it have one function type 'data loading' but what about performance? does IIS affected by that or not? also is it better to make multi web-services 'asmx files' or just one!
I'm building a new ASP.NET MVC application (in C#) and one of the requirements is to create a new database of members. For this, we'd need roles to manage the different types of members and profiles to manage the additional metadata attached to each member. So far so good, just use the standard MembershipProvider, RoleProvider and ProfileProvider provided as part of the .NET Framework.
However, the catch is that I'd like to allow different authentication methods. I'd like Accounts and Login Credentials to have a one-to-many relationship (one account can have a number of login credentials attached). A user for example, might have both an OpenID and ActiveDirectory account attached to their account.
However, after experimenting with a few ways we opted for the MembershipProvider route (explained how it was achieved as an answer below).
It appears to be something that is achieved on quite a number of sites, yet a search on here doesn't return anything solid to play around with.
EDIT: After looking around for a good period of hours overnight and this morning - I'm still not convincinced that butchering a single MembershipProvider would have been the easiest option. Does having multiple MembershipProviders give the same effect?
BOUNTY EDIT: With no responses, I am assuming that there is no more optimal solution that the one I posted as an answer. Is this really the case? I'm offering a bounty to try and see if anyone has any further thoughts on this and whether there are better alternatives.
BOUNTY ACCEPT EDIT: I think that WIF is the answer as accepted below, for a .NET 4 release and maybe other versions as it probably works with 3.5. Other than that, maybe a butchered MembershipProvider or adapted one may still be relevant.
First off I'm a week into asp so apologies in advance for silly questions! I am looking to connect to a SQL database table and allow the user to filter the table based on a search box on the asp page. I have written a sql query with a parameter in the where clause, a bit like this:
select col1, col2 from table where col1 like @my_parameter
Then I pointed the parameter to a textbox on my asp page, and this seems to work quite well. However, I would now like to add an additional search facility which would be a dropdown list. This would be sourcing all the unique values from the col2 in my table abve (there are only about 10 possible values here). But I don't want users to be able to use both of these searches at the same time.
So the bottom line is I would like to offer two methods of filtering the same data table, which search on different columns of the data table. Then the results should populate the same results table, but the user must only be able to use one search method or the other.
I have done a bit of research but couldn't find anything along these lines (I think it is becuase I don't know the words of the things I should be searching for!). I did find information on a standard postback event or cross page posting - not sure which of these (if any) is the best to use for a beginner?
In one of the applications I am working on, there are two basic functionalities included: Create and Update. However, there is a need sometimes to add custom code, so I thought of extending the code by allowing 3rd parties to write and embed their own code:
OnCreating OnCreated OnUpdating OnUpdated
Is there a way to enable the above across multiple assemblies? MEF might help here?
My requirement is to show a page with multiple filters to apply to grid data.
Suppose we are talking about Orders and an order has the following attributes
public class Order { public int OrderID public DateTime OrderDate public DateTime ShipmentDate public int OrderTotal public int OrderStatus }
Inside the jqgrid object I am showing all the attributes except the OrderStatus
The requirement is to create a view that has the jqGrid on the left part a panel on the right
Inside the right panel the user will see a list of checkboxes that represents every possible OrderStatus value and he want to search using both methods (for example selecting the checkbox "Shipped Orders" and then filtering the grid with Amount greater than a value)
I have already configured the advanced filtering (multiplesearch:true) inside the jqGrid object and I am able to create complex filters combining fields and logical operators.
how I can submit even the data from the right panel when the user press the search button?
Update 1:
Preamble: Oleg sample is fantastic but unfortunately does not fits requirements of my customer :(
@Oleg: I do not understand why you think that:
If the data are outside of the grid you will be show the order details on the right pane only for selected row. So the user will have not so good overview of the data.
maybe my description was not so clear but I am not going to show any order detail. To better clarify my requirement I have modified your sample to show you the desired final UI which is as in the following image:
The customer want to filter the data in the grid using two methods or both together:
Using the multiplesearch facilities provided by the grid itself (thanks for the workaround mention) Using the custom Search Panel (the one with the checkboxes on the right) provided
From a functional point of view the requirement is very easy to express: When the user click on a checkbox or make a search using the native multiplesearch I should post values to the server including also the checkboxes state.
To summarize I should:
Add the checkboxes state when a post is made through the native multiplesearch
Add the current multiplesearch state (if any) when the user click on a checkbox
I've created a Gridview in my aspx page, which is referenced in two separate methods in the code-behind file. When I try to run the page, I'm getting a 'does not exist in the current context' error.After a bit of poking on the internet, it seems that I might need to declare the gridview at the class level if it's going to exist in more than one method... problem is, I do that and it disappears from the page altogether.I'm obviously not doing this right - I'm declaring it like this (abridged version):