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 :
Add this in your web config.
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>