C# - Creating And Exposing Web Service In MVC 2
Feb 20, 2011
I've looked around for some tutorials, but everything I see is how to use REST services with my app. But that's not really what I need, I'm not doing basic GET requests, the end user needs to do some complicated calculations with several classes and variables from my web service.
In a Web Forms app, I would just add a Web Services solution and do everything in there. Is that the recommended solution for an MVC app?
View 2 Replies
Similar Messages:
Feb 24, 2011
We need to expose some services (i.e. AddressValidatorService, CustomerFinderService) that currently reside in an ASP.NET application to other applications within our organization. Exposing these services via WCF seems like a natural fit, but I don't see any best-practices for how to pull these common services into a WCF wrapper in such a way that my existing ASP.NET application can continue to use them with minimal code changes and/or awareness that the service they are consuming is no longer in-process. I'm especially looking for recommendations on how to structure the existing ASP.NET solution and whether to host our new WCF in the same solution or in some new shared WCF solution referenced by both our ASP.NET application and external callers.Also, is it bad practice to simply promote the DTOs currently only consumed in-process via ASP.NET to full fledged data contracts or is it preferable to create duplicate DTOs that are explicitly decorated with [DataContract]?
View 3 Replies
Oct 29, 2010
Considering the recent ASP.NET vulnerability, what should I look for in my httphandlers that would cause such a Padding Oracle vulnerability?
Asked in another way... what did MSFT do wrong and what did they fix in their handlers?
View 2 Replies
Feb 17, 2010
In Visual Studio 2005.I have created a Blank solutions(XYZ) and then add a ASP.Net Web Service Project(TESTP) under it.And then create a .asmx file(WEBFI.asmx) and then write a method and add [WEB Method] on top of the method.Now compile it.And then publish it.But in publishing folder I didn’t found any WSDL file which I should call in different machine (which is in LAN ).
View 6 Replies
Sep 13, 2010
I wounder if there are some differencences when creating a wcf serivce to a MVC webbapplication.
how to create such a serivce for a MVC application. and returns a json object.
View 3 Replies
Sep 13, 2010
I wonder if there are some differences between creating a WCF service and an MVC web-application. If you know of good links on how to create such a service for an MVC application that returns a JSON object please do post them.
View 1 Replies
Nov 11, 2010
I am trying to create an msi for a Web Service. I want the web service to be installed as a 'Web Site' not as an 'Application' under Default Web Site in IIS. I have code that creates a web site, but when I try to add it as a custom action under the install node of the msi, the code isn't getting executed. Reading about installers, it seems that anything under the install node gets fired after the installer has already started, if that makes sense. I want to be able to create the web site before the installer actually begins the installation process so that when the user comes to the window where he/she has to choose the Site under which to install the web service it can already be listed there and they'll be able to choose it.
View 1 Replies
Mar 24, 2011
I am trying to create a web service application that will need to use .net 4.0 for my datamodeling and other things. I noticed in VS2010 when I select New | Project the "ASP web service app" option is available if .net 3.5 is selected in the combo box but if I change that to .net 4.0 the option goes away.
After researching the only thing I found was a message where someone suggested to use the WCF web service option. I have never dealt with WCF before so I have no idea what path that will lead me down.
Here is my concern... we have existing web services developed in .net 3.5 that are already in use and we have windows based client applications that are developed in Delphi (version 7.0 to be specific) that already talk to these web services with no problems and no special coding required. Delphi can simply import the WSDL which generates an interface unit that gets compiled in and away we go. This new service app I need to create must also be accessed via the same Delphi apps.
The current asp web service apps generate 4 files when "published": web.config, .asmx file and in a in folder there is a .pdb and .dll file.
Can anyone tell me if support for this type of web service app is still available via .net 4.0 and if so how do I create the project or is that something that has been discontinued and thus no longer possible?
View 2 Replies
May 7, 2010
I have a large .NET based system running within the company intranet, which allows winforms users to see some live calculated numbers and a custom winforms control drawn live (but not real-time). The Forms users can also affect the operation of the system.
I would like to just show the live numbers on a website, along with the custom control. Nothing needs to come back from the web user, as the web app is meant to be just for monitoring. All the numbers can be calculated at the server. It's been a long time since I touched ASP.NET, and I need to know how to proceed. What are the steps in building and deploying such a website? Any caveats I need to look out for?
View 3 Replies
Mar 5, 2011
I am new to the whole ajax/jquery/web service scene. I am trying to create a web service to pass back data for a jquery post and currently have two errors. It appears there are examples the web but must in c and looking for something in vb. Below is my web service. See in bold the error descriptions and in red the items visual studio is highlighting.
WordsService.asmx
HTML Code:
<%@ WebService Language="VB" CodeBehind="~/App_Code/WordsService.vb" Class="WordsService" %>
WordsService.vb
Code:
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Runtime.Remoting.Services
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Data
Imports System.Web.Script.Serialization
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="[URL]
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WordsService
Inherits System.Web.Services.WebService
Private _sConn As String = ConfigurationManager.ConnectionStrings("DB").ConnectionString
'1) Type 'ScriptMethod' is not defined.
'2) Value of type '1-dimensional array of String' cannot be converted to '1-dimensional array of 1-dimensional array of String' because 'String' is not derived from '1-dimensional array of String'.
<WebMethod(Description:="Gets the books matching part of a title."),
ScriptMethod(ResponseFormat:=ResponseFormat.Json)> _
Public Function GetBooksByTitle(ByVal strTitle As String) As String
Dim myConnection As SqlConnection = New SqlConnection(_sConn)
Dim objCommand As SqlCommand = New SqlCommand("SELECT * FROM table WHERE field like '%" _
+ (strTitle + "&' ORDER BY field;"))
Dim dsSearch As DataSet = New DataSet
Dim sdaSearch As SqlDataAdapter = New SqlDataAdapter(objCommand)
sdaSearch.Fill(dsSearch, "english")
myConnection.Close()
' Create a multidimensional jagged array
Dim JaggedArray()() As String = New String((dsSearch.Tables(0).Rows.Count) - 1) {}
Dim i As Integer = 0
For Each rs As DataRow In dsSearch.Tables(0).Rows
JaggedArray(i) = New String() {rs("BookNum").ToString, rs("Title").ToString, rs("Author").ToString}
i = (i + 1)
Next
' Return JSON data
Dim js As JavaScriptSerializer = New JavaScriptSerializer
Dim strJSON As String = js.Serialize(JaggedArray)
Return strJSON
End Function
End Class
Here is the article I am currently following for example: How To Create A JSON Web Service In ASP.NET.
View 3 Replies
Dec 1, 2010
I am creating a singleton object in the first request to the web service and keeping it in the memory. This works fine for first few seconds. If I make a request 5 minutes later, I can see that the singleton object is created again? is my singleton object getting disposed after x no of minutes? how can i make increase the life-time of my object forever ?
public sealed class Singleton
{
static ServerInstance instance = null;
static readonly object padlock = new object();
Singleton() {
}
public static ServerInstance Instance {
get {
lock (padlock) {
if (instance == null) {
instance = new ServerInstance();
}
return instance;
}
}
}
~Singleton()
{
#if DEBUG
ExceptionFactory.Fatal("~Singleton() called!");
#endif
}
}
[WebMethod]
public string OnReceiveEvent(string objectXmlData, string objectType) {
if (!Singleton.Instance.initServerComplete) {
InitServer();
}
return Singleton.Instance.OnReceiveEvent(objectXmlData, objectType);
}
public void InitServer() {
if (!Singleton.Instance.initServerComplete) {
Singleton.Instance.InitServer();
Singleton.Instance.initServerComplete = true;
GC.KeepAlive(Singleton.Instance);
}
}
View 2 Replies
Mar 2, 2011
i have a requirement to build some sort of services that can easily be called to a 3dr party API.
the call can be done through simple
1) HTML page
2) ASPX page
3) MOBILE device
should i create a separate web service project separately and create few methods [WebMethod] ?
also the method can be static?
/// <summary>
/// Summary description for signup_service
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[Code]....
View 1 Replies
May 25, 2010
Is there any framework or tool to generate web services (WCF) access to all the non transactional tables in my database? something like asp.net dynamic data but with web services, I need to do this for homologation with other systems.
View 3 Replies
Nov 16, 2010
I have a class with about 5-10 methods which all my services (WCF) need to expose. What is the best way to expose all the methods in all the services keeping (DRY principle) in mind?Is interface inheritence a good design principle? e.g. public interface IBMW : ICar
{
blah();
blah();
}
View 1 Replies
Sep 8, 2010
I am trying to simulate a sample web service payload similar to that which i will receive one the webservice is live. Can anyone help me simulate this?Criteria for my response will be:a bool pass or fail string - message and the object (in this case in the form of a list) heres the class I am to populate with sample data:
[Code]....
How can I use this class to put sample data in it? Lets say I want to put customers in the list 'ReturnObjects'?
View 6 Replies
May 21, 2010
The following code is part of a WCF service. Will eventWatcher take up a thread in the ASP .NET thread pool, even if it is set IsBackground = true?
[code].....
View 1 Replies
Jul 23, 2010
I am creating new WCF service and i would like to do two way XML for communicating with third party vendors. My wcf service get the request from the outside program by means of URL and it should response accordingly.
Example - I have url which third party will call and put xml as a request, i have to get that xml, work accordingly and response back with either success or failure and appropriate xml. I need to make it completely automatic so anybody can call that url, it will validate that user and do the next step of request and response.
View 1 Replies
Jan 15, 2011
i am in the process of creating a restful service with WCF, the service is likely to be consumed by at least 500 people at any given time. What settings would i need to set in order to deal with this.
Here is a sample of what i have so far;
[Code]....
And this is an example of a method being called;
[Code]....
View 1 Replies
Dec 17, 2010
We are consuming third Web services.
Instead of using datatypes from web service proxy we need to create our own class which will take the values from web service output.
Since the web service data types are so much deep,we are facing lots of problems to create our cutom classes.
Is there any tool available to create classes directly from web services in ordered way....
View 2 Replies
Mar 18, 2010
I'm facing a senario in which I want my logged in users can send requests to each other(Request generally is official request like request for resources, etc.).
And other user can get notification for new request(But this is not about e-mail notification).I want to use ajax. I have no idea how to start with. Please somebody help me with this. Simple example will be great to start with.
View 3 Replies
Dec 16, 2010
i had my code in .aspx page which i trnasfeered to the .asmx pageso i get error in few places in .asmx pageUnable to cast object of type 'System.String' to type 'System.String[]'earlier i had a label control which i hve replaced with a variable in .asmx pagelet me knw hoe to do the few modification to make it workingi hve the below code which gives me conversion frm string to string[] errorPrivate Shared errorList As List(Of String) = New List(Of String)dim msg as string
If errorList.Count = 0 Then
msg="Sucessfully done"
Else
[code]...
View 2 Replies
Apr 20, 2010
In Visual Studio 2010, I don't see the Visual Studio installed template to create an ASP .Net Web Service Website (when I click on File->New->Web Site..) if the target framework is 4.0. However if I switch to FW 3.5 or lower, I do see the template.
View 1 Replies
Feb 22, 2011
I wont to restrict my web service only for few domains.
I wont to have access to web service from using ajax and my page, and I don't want that anybody can create client to my WebService and view my web service methods.
View 4 Replies
Mar 23, 2010
I get the following error which I don't get when I build a simple WCF Data Service in an non MVC project. I added the following to my global.asax:
[Code]....
The type 'MvcWebApp.WcfDataServiceTwitter', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
View 2 Replies
Apr 27, 2010
I have to define a web method which will fetch XML documents from another web service based on the list of projects from the database. Now I need to send these XML documents in different SOAP envelopes. XML documents can be more than one.
View 1 Replies