Click here to Skip to main content
15,886,519 members

Unable to insert a record in to sql server database while hosting application in iis.

Sudheer Reddy K asked:

Open original thread
I created a rest service which contains two methods one method to get the records from data base using Get verb.I'm successful in getting that.But while another method is post which is used to insert a record in to the table. But it is giving error response text as:

Here is the response given to my html file:

HTML
  <body>

    <div id="content">

      <p class="heading1">Request Error</p>

      <p>The server encountered an error processing the request. The exception message is 'An error occurred while updating the entries. See the inner exception for details.'. See server logs for more details. The exception stack trace is: </p>

      <p>   at System.Data.Entity.Internal.InternalContext.SaveChanges()

   at EmployeeService.EmployeeInfoService.InsertEmployee()

   at SyncInvokeInsertEmployee(Object , Object[] , Object[] )

   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)

   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)

   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage31(MessageRpc& rpc)

   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)</p>

    </div>

  </body>

</html>



But I'm able to insert the record by not hosting in IIS.
Before i was unable to get the records also.I that time i searched the internet.They said you should add network service login to sql server and add suitable priveleges to the data base. After that i'm able to get the records and display in browser.But the insertion is not happening.Please suggest me the solution?
Tags: IIS 7.0, IIS

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900