Add this in your web config.
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
Question
i write a Web Service.asmx to provide a dollar price service for other sites. but when i publish it into my website and go for test it i receive this exception :
The test form is only available for requests from the local machine.
I Use code below in my asmx file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
/// <summary>
/// Summary description for Services
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class Services : System.Web.Services.WebService
{
[WebMethod]
public string USD_Prices()
{
string UnitedStateDollar;
using (var Entity = new DataModel.DBEntities())
{
var UsdPrice = Entity.TblExchange.OrderByDescending(Exchange => Exchange.Id).Select(p => p.USDSell).Take(1).ToList();
UnitedStateDollar = UsdPrice[0].ToString();
}
return UnitedStateDollar;
}
}
So what is the problem?....and if you Want to check it online the address is :
OTHER TIPS
There's no problem. Web services don't have forms. In order to use a web service from .NET, you add the as a service references and call them from client code.
Old-style ASMX services had a form you could use for demonstration purposes where you could enter some simple values and call POST to get a result from the service. This was removed in WCF services because real-world web services have complex parameters that can't be handled by a simple form.
It would be far better to create a WCF service instead of an ASMX service. WCF services are more compliant, performant, flexible, scaleable (etc etc).
In any case, you can call you service from another client by adding a Service Reference to your project. This will create a proxy class that will expose the service's parameters as objects and the endpoints as methods on a client object.