The tablename value must be assigned to the WCF able returned by WCF.

Source: Internet
Author: User

Recently, when I was studying WCF and returned to the able, "An error occurred while loading ing the HTTP Response to http: // localhost: 9999/calculatorservice. this cocould be due to the service endpoint binding not using the HTTP protocol. this coshould also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down ). see server logs for more details.. After checking for half a day, we found that the original returned able did not assign a value to tablename.

 

Code

Public System. Data. datatable getdatatable ()
{
Datatable mydt =   New Datatable ();
Mydt. Columns. Add ( " Userid " , Typeof ( Int ));
Mydt. Columns. Add ( " Username " , Typeof ( String ));
Mydt. Columns. Add ( " Birthday " , Typeof (Datetime ));
For ( Int I =   0 ; I <   300 ; I ++ )
{
Datarow Dr = Mydt. newrow ();
Dr [ " Userid " ] = I +   1 ;
Dr [ " Username " ] =   "Xx "   + I;
Dr [ " Birthday " ] = Datetime. now;
Mydt. Rows. Add (DR );
}
Return Mydt;
}

 

Then add mydt. tablename = "mydt.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.