Reputation: 1743
I have a windows 2008 r2 server running IIS 7(Yes it is old this is what is available for me). It has a website running at port 8080.
I have created an Empty Template ASP.NET web application. Then I added new item named Phones.asmx
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Odbc;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
using System.Xml.Serialization;
namespace OSS_network
{
/// <summary>
/// Summary description for Phones
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 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 Phones : System.Web.Services.WebService
{
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
[WebMethod]
public string Phonebook()
{
return "PhoneBook";
}
}
}
Then i published it to a folder which contents i copied to a folder on the Win2008 server. In IIS I created a new Website on port 8080 and the path linking to the folder where the published files are located.
I am able to connect to Phones.asmx from the local machine(the server itself) and view methods as well as call them.
Then I try to connect to Phones.asmx remotely which is succesful. I can see the defined WebMethods,
BUT
when I try to call the method I get the following error:
Can someone help out with this error? It must be some thing simple.
Upvotes: 0
Views: 328
Reputation: 1743
I have the answer because I good samaritan answered in my last question which got closed down because of not enough information.
I use following line of code to fix this problem. Write the following code in web.config file.
<configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
</system.web>
</configuration>
Hope this helps the next person in trouble like mine.
Upvotes: 2