?
Solved

WEB SERVICE GIVING "The request failed with HTTP status 406: Not Acceptable". ERROR

Posted on 2004-04-11
8
Medium Priority
?
814 Views
Last Modified: 2007-12-19
Hi All,
I have made a webservice and it is working fine on the local server but when I upload to our main SERVER and add its reference to winform and try to call it, it is giving a strange error and I am not able to debug what the problem is. the error that appears is

Server Error in '/WebApplication2' Application.
--------------------------------------------------------------------------------

The request failed with HTTP status 406: Not Acceptable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Net.WebException: The request failed with HTTP status 406: Not Acceptable.

I couldn't find what the problem is all about. Kindly help
0
Comment
Question by:brainstogether
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
8 Comments
 
LVL 2

Expert Comment

by:majodio
ID: 10804999
Make sure that any references to old URLs in your web service have been changed to match your production server.

Very strange that I could not find anything on Google about this problem.
0
 
LVL 2

Accepted Solution

by:
majodio earned 2000 total points
ID: 10805021
Also, in order to debug the program you might want to write Debug messages into a log file of some type.  Here's a function that you can use to do that:

    Private Sub WriteLog(ByVal Msg)
        Dim SW As StreamWriter
        Dim M As Mutex
        Dim Created As Boolean
        Try
            'Ensure that only one thread has access to the log file at any given time
            M = New Mutex(False, "WriteLog", Created)
            M.WaitOne()
            ' This text is added only once to the file.
            If Not File.Exists("LogFileFullPath") Then
                ' Create a file to write to.
                SW = File.CreateText("LogFileFullPath")
            Else
                SW = File.AppendText("LogFileFullPath")
            End If
            SW.WriteLine(DateTime.Now & " - " & Msg)
            SW.Flush()
        Finally
            M.ReleaseMutex()
            If Not IsNothing(SW) Then
                SW.Close()
                SW = Nothing
            End If
        End Try
    End Sub
0
 

Author Comment

by:brainstogether
ID: 10806970
Yes majodio I also didnt find anything on google so its too hard for me...so just want some Ideas from fellow experts.
Actually this error is coming when I try to call the webservice from within an ASP application folder....I made it a virtual directory though and I can browse the webservice but at the time of calling ...it gives error in the invoke function in references.cs.
When I made it a virtual directory in a folder that contains the dotnet application it did run well....so I checked the folder permissions but they were all same.
The jist is that it is creating the object of the class in webservice too but when I try to call the function it gives that 406 Error and points to the invoke function in reference.cs file.
please let me know anything u can think of...I will also try out and if even the guesses are correct.... I will be happy to give u the points.
0
More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

 
LVL 2

Expert Comment

by:majodio
ID: 10807372
Hmmm...  Interesting...  I guess that your testing so far points to a permissions problem.  Are you running the web service in the root of the web server?  Are you sure that the ASP.Net user has Read/List permissions to that folder?
0
 

Author Comment

by:brainstogether
ID: 10810920
yes the webservice is in root and the folder under which I have made it a virtual directory is also having the ASP.Net user Read/List permission
0
 
LVL 2

Expert Comment

by:majodio
ID: 10812373
Can you invoke the web service by hand?  In essence without using the Winform and just browsing to it with a web browser?  Also, are you sure that you're handling any error correctly in your code?

I'm guessing you've tried all of these things, but I don't have a clue on this one.  I'll continue to think about it, though.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question