Home > Net >  AJAX access to WCF boarding WinForm
AJAX access to WCF boarding WinForm

Time:04-08

BBS has a code to download but can't run.
Together online code
The Host=new ServiceHost (typeof (WcfService1 Service1));
//bind
System. ServiceModel. Channels. Binding httpBinding=new BasicHttpBinding ();
//endpoints
Host. AddServiceEndpoint (typeof (WcfService1 Service1), httpBinding, "http://localhost:8002/");
If (the Host) Description) Behaviors. Find ()==null)
{
//behavior
ServiceMetadataBehavior behaviors=new ServiceMetadataBehavior ();
Behaviors. HttpGetEnabled=true;
//metadata address
Behaviors. HttpGetUrl=new Uri (" http://localhost:8002/Service1 ");
The Host. The Description. Behaviors. The Add (Behaviors);
//start
The Host. The Open ();
MessageBox. Show (" 1 ");
}

Can only access http://localhost:8002/Service1 returns the XML
But the visit http://localhost:8002/Service1/GetFun2? UserID=as& OperaID=23 method not inside
  •  Tags:  
  • C#
  • Related