asp.net mvc - Pass method from MVC to WCF -
i made in controller method should creat product
[httppost] public actionresult create(producttype product) { if (modelstate.isvalid){ servicereference1.service1client proxy = new servicereference1.service1client(); proxy.addproduct(product); return redirecttoaction("index"); }
and addproduct in wcf service
public void addproduct(producttype product) { product _product = new product(); _product.name = product.name; _product.adddate = datetime.now; _product.price = product.price; _product.isactive = product.isactive; _product.categoryid = product.categoryid; baseshopentities producttoadd = new baseshopentities(); producttoadd.addtoproduct(_product); }
but have error saw infos in net can't find solution on problem.
the server unable process request due internal error. more information error, either turn on includeexceptiondetailinfaults (either servicebehaviorattribute or configuration behavior) on server in order send exception information client, or turn on tracing per microsoft .net framework sdk documentation , inspect server trace logs.
service references\servicereference1\reference.cs line: 78
line 76: line 77: public void addproduct(shop.data.producttype product) { line 78: base.channel.addproduct(product); line 79: } line 80: }
any1 know solution ?
looking @ code provided not obvious problem is. can see call producttoadd.addproduct.
you should add includeexceptiondetailinfaults attribute configuration file because when addproduct, on web service, throws exception can handled in mvc application , wcf place information exception thrown addproduct inside of handled exception.
you should able run wcf , mvc applications @ same time within visual studio allow debug addproduct on wcf service.
Comments
Post a Comment