Answered by:
Error when runing my application from internal webserver "The remote server returned an error: (400) Bad Request."

Question
-
I have a Asp.net 3.5 Web Application project in which i have placed my WCF service
From this WCF service I do some user authentication and some file uploading to my webserver.
Now Problem is that when i run my Web application from internal webserver "Cassini" and call any method of WCF service i get the error "Error when runing my application from internal webserver "The remote server returned an error: (400) Bad Request."
While if i make a virtual directory of My Web application and run my application from there then it runs fine.
I change the binding address as per my need when using internal web server or virtual directory
Please let me know what might be the thing i may be doing wrong
Kamran Shahid Senior Software Engineer/Analyst (MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web])Sunday, December 20, 2009 1:28 PM
Answers
-
Hi Kamran,
As you mentioned below:
"I change the binding address as per my need when using internal web server or virtual directory"
do you mean that you have manually specify an endpoint address for your WCF service(.svc endpoint) in web.config file? If this is the case, I think it will cause problem since the endpoint address for .svc service in web application are fixed at the .svc file's http location, we cannot change it to arbitrary address like what we do in self-hosting scenario.
Also, the Visual Studio test webserver is only a simple webserver which can only works for local connections, if you try visiting it from remote machine, it will not work.
In addition, 400 is quite a general error, there might be some detailed error at service runtime, you can enable WCF service tracing to see whether you can get detailed error info:
#Configuring Tracing
http://msdn.microsoft.com/en-us/library/ms733025.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Proposed as answer by Steven Cheng - MSFT Tuesday, December 29, 2009 6:32 AM
- Marked as answer by Steven Cheng - MSFT Wednesday, December 30, 2009 5:07 AM
Tuesday, December 29, 2009 6:31 AM
All replies
-
cassini does not support authentication. You are better off using IIS, like you are already using, to test your service.
Amit Sharma- Marked as answer by Riquel_Dong Friday, December 25, 2009 6:54 AM
- Unmarked as answer by Kamran Shahid Friday, December 25, 2009 5:50 PM
Monday, December 21, 2009 5:56 PM -
I am not checking it through windows or form authentication.I am just calling a method of my WCF service which will return a int on which bases i do my processing.
Kamran Shahid Senior Software Engineer/Analyst (MCP,MCAD,MCSD.NET,MCTS,MCPD.net[web])Tuesday, December 22, 2009 5:52 AM -
Typically the bindings use the default security(The exception is BasicHttpBinding). You can check your client configuration file in ServiceModel to see the default security settings in this situation.
Best regards,
Riquel
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.Wednesday, December 23, 2009 3:59 AM -
Hi Kamran,
As you mentioned below:
"I change the binding address as per my need when using internal web server or virtual directory"
do you mean that you have manually specify an endpoint address for your WCF service(.svc endpoint) in web.config file? If this is the case, I think it will cause problem since the endpoint address for .svc service in web application are fixed at the .svc file's http location, we cannot change it to arbitrary address like what we do in self-hosting scenario.
Also, the Visual Studio test webserver is only a simple webserver which can only works for local connections, if you try visiting it from remote machine, it will not work.
In addition, 400 is quite a general error, there might be some detailed error at service runtime, you can enable WCF service tracing to see whether you can get detailed error info:
#Configuring Tracing
http://msdn.microsoft.com/en-us/library/ms733025.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- Proposed as answer by Steven Cheng - MSFT Tuesday, December 29, 2009 6:32 AM
- Marked as answer by Steven Cheng - MSFT Wednesday, December 30, 2009 5:07 AM
Tuesday, December 29, 2009 6:31 AM