|
|
|
не подключается веб-сервис
|
|||
|---|---|---|---|
|
#18+
Не могу добавить веб-сервис к своим проектам. Создаю простенький веб-сервис, но когда выбираю "Add web reference" и печатаю адрес (например, http://localhost/MyWebService/QueryUser.asmx) - он открыввается с левой стороны окна. А с правой стороны выдает: No web References were found on the page. В разделе ошибок пишет: "there was an error downloading http://localhost/MyWebService/QueryUser.asmx. The Underlying connection was closed: The remote name could not me resolved." Для прокси испрользую локальный хост (адрес: 127.0.0.1 порт 80) (Windows 2003) По всей видимости прокси неверно настроен, чтобы брать веб-сервис с локального компьютера - может кто-нибудь подскажет в чем может быть проблема? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 06.11.2007, 00:38 |
|
||
|
не подключается веб-сервис
|
|||
|---|---|---|---|
|
#18+
1) Пишется веб-сервис. 2) Тестируется 3) Генерится прокси 4) Прокси покладается в другой проект который пользует сервис. 5) Работаем с методами сервиса в другом проекте Вот пример простого сервиса: Файл Ws.cs using System; using System.Web; using System.Collections; using System.Web.Services; using System.Web.Services.Protocols; /// <summary> /// Compilation string /// wsdl /language:cs /out:C:\Inetpub\wwwroot\dev\App_Code\ws.cs http://localhost/ws/ws.asmx?wsdl /// </summary> [WebService(Namespace = "http://localhost/ws/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Ws : System.Web.Services.WebService { public Ws() { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World"; } [WebMethod] public string HelloString(string input) { return input; } } Файл Ws.asmx: <%@ WebService Language="C#" CodeBehind="~/App_Code/Ws.cs" Class="Ws" %> ---- Файл другого проекта SimpleWebService.aspx.cs: // proxy class generate code // wsdl /language:cs /out:C:\Inetpub\wwwroot\dev\App_Code\ws.cs http://localhost/ws/ws.asmx?wsdl public partial class SimpleWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Ws webs = new Ws(); webs.Url = "http://localhost/ws/Ws.asmx"; Response.Write(webs.HelloWorld()); Response.Write("<br/>"); Response.Write(webs.HelloString("Это я написал!")); } } } Страничка SimpleWebService.aspx - пустая. прокси-класс приводить не имеет смысла Это реально бегающий пример. Перевернув мир - оглянись, может перевернулся ты сам?! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 06.11.2007, 03:29 |
|
||
|
|

start [/forum/topic.php?fid=60&gotonew=1&tid=2163132]: |
0ms |
get settings: |
11ms |
get forum list: |
21ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
96ms |
get topic data: |
14ms |
get first new msg: |
7ms |
get forum data: |
3ms |
get page messages: |
51ms |
get tp. blocked users: |
2ms |
| others: | 240ms |
| total: | 453ms |

| 0 / 0 |
