Error in WCF Service method while working with AJAX application
I am trying to access WCF service through AJAX in Visual Studio 2008.
For this, I have create one Service Library project with the name: BLM.ServiceLibrary. In this service library project, I have created one interface, one class implemented from that interface, one LINQ to SQL data classes item template to communicate with database.
I am trying to access this project from one another client project (Simple ASP.NET project) with the name: BLM. In this BLM project (client project) I have created one CRService.svc file to access the service from BLM.ServiceLibrary project. I have configured my web.config file inside BLM to access AJAX Service.
Following is the code for my web.config file. 开发者_JAVA技巧I think all the section inside is sufficient for my doubt. Hence I am presenting the code below:
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service behaviorConfiguration="" name="BLM.ServiceLibrary.CRService">
<endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="" contract="BLM.ServiceLibrary.ICRService" />
</service>
</services>
</system.serviceModel>
I am getting the following error.
CAN ANYBODY HELP ME TO SORT-OUT THIS PROBLEM. Please...
One more doubt: In the error description also told me to turn on IncludeExceptionDetailInFaults. How to do this
Microsoft JScript runtime error: Sys.Net.WebServiceFailedException: The server method 'AddCR' failed with the following error: null-- The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.
I forgot to code like:
commandName.CommandType = CommandType.StoredProcedure;
Hence, I got the above error.
精彩评论