English 中文(简体)
ASP. 网上服务
原标题:ASP.Net and Web Services

I have been searching for 4 days non stop. I am sleep deprived and going crazy. Can someone please help me or at least tell me what I m doing wrong. This is my project Develop a client web page app that uses the web service found at http://www.marksmerry.com/peanutbutter/WebService1.asmx. The service generates a random number m This service receives a guess , an integer between 1-100 inclusive. It returns a string:

  • low - if the guess is lower than m
  • equal – if the guess is correct
  • high - if the guess is higher than m

我已经提到网络服务,但我是在辛塔克斯丢失的,或帮助我! 这是我迄今为止所做的。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using localhost;
using System.Web.Services;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        localhost.WebService1 ws1 = new WebService1();
        //What goes in this area. I have been searching and have tried all kinds of combination all have resulted in build errors


    }
}
问题回答

方法清单将列出。

视像室发现的、你提到大白网服务的任何服务方法,都可以上代相传的班级(您的代码例中称为WebService1)。

string results = ws1.Guess(42);

When you added the reference you should have got the chance to give it a name. It s only semantics but it might be better to give it a different name from localhost.

以前的评论者提出了很好的建议,因此我随后提出这些建议。

Only thing I d suggest is this.

可见结果 = ws1.Guess(“10”);/EDIT:这当然是错误的。 采用t.

我今天上午利用网络服务做了一些工作。

ICoservice. Service1 v24 = new myCoservice. Service1();

System.Xml.XmlNode doc = v24.CreateSite(newSiteName);

这应当简单。

如果是,我再次审视一下你如何建立你的网络。 并请我们知道你正在使用何种网络框架。

我在一页上添加了试验项目的参考资料,并在一页上登出了该活动。

    protected void PeanutGuess_click(object sender, EventArgs e) {
        PeanutButter.WebService1 pb = new PeanutButter.WebService1();

        string response = pb.Guess(10);

        lblResult.Text = string.Format("Response for 10 is " + response);
    }

这对我来说是罚款的。 使用VS2010和项目使用的净额3.5





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签