HTTP 400 Bad Request on method GET request for WCFService
I am using fiddler to test my web service. It connects to a SQL server database (that is connected and running) The get works on local host and through IIS Express in VS 2017. On IIS, the server works except for the GET request through fiddler. Please let me know if you need to see my Service1.svc
file (To much code not enough text error) I have tried all other answers
web.config
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<!--<behavior>
To avoid disclosing metadata information, set the values below to false before deployment
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior> -->
<bindings>
<webHttpBinding>
<binding name="restLargeBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed">
<readerQuotas maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="myWebEndPointBehaviour">
<webHttp automaticFormatSelectionEnabled="true" defaultBodyStyle="Bare" defaultOutgoingResponseFormat="Json" helpEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="myServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TestWcfService.Service1" behaviorConfiguration="myServiceBehaviour">
<endpoint address="" contract="TestWcfService.IService1" binding="webHttpBinding" bindingConfiguration="restLargeBinding" behaviorConfiguration="myWebEndPointBehaviour"></endpoint>
<endpoint address="mex" contract="TestWcfService.IService1" binding="mexHttpBinding" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
IService1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace TestWcfService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{
// TODO: Add your service opperations here
// Get Method
[OperationContract]
[WebGet(UriTemplate = "GetUserName")]
List<UserName> GetUserName();
// Post Method
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "AddUser", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
int AddUser(string user);
}
[DataContract]
public class UserName
{
string user;
[DataMember]
public string User
{
get { return user; }
set { user = value; }
}
}
}
c# wcf iis get fiddler
add a comment |
I am using fiddler to test my web service. It connects to a SQL server database (that is connected and running) The get works on local host and through IIS Express in VS 2017. On IIS, the server works except for the GET request through fiddler. Please let me know if you need to see my Service1.svc
file (To much code not enough text error) I have tried all other answers
web.config
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<!--<behavior>
To avoid disclosing metadata information, set the values below to false before deployment
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior> -->
<bindings>
<webHttpBinding>
<binding name="restLargeBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed">
<readerQuotas maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="myWebEndPointBehaviour">
<webHttp automaticFormatSelectionEnabled="true" defaultBodyStyle="Bare" defaultOutgoingResponseFormat="Json" helpEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="myServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TestWcfService.Service1" behaviorConfiguration="myServiceBehaviour">
<endpoint address="" contract="TestWcfService.IService1" binding="webHttpBinding" bindingConfiguration="restLargeBinding" behaviorConfiguration="myWebEndPointBehaviour"></endpoint>
<endpoint address="mex" contract="TestWcfService.IService1" binding="mexHttpBinding" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
IService1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace TestWcfService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{
// TODO: Add your service opperations here
// Get Method
[OperationContract]
[WebGet(UriTemplate = "GetUserName")]
List<UserName> GetUserName();
// Post Method
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "AddUser", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
int AddUser(string user);
}
[DataContract]
public class UserName
{
string user;
[DataMember]
public string User
{
get { return user; }
set { user = value; }
}
}
}
c# wcf iis get fiddler
Can you debug the wcf service?
– Chetan Ranpariya
Nov 22 '18 at 4:09
I could, but I do not get an error in visual studio, only on fiddler
– inDepth
Nov 22 '18 at 4:11
1
I would suggest to write proper exception handling in your code and write the error and exception detail in some log file. So that you can know what exact error you are getting. The Fiddler screen capture you share does not say anything about the error message. So not sure what could be the issue. I assume there that the Visual Studio, IIS and the fiddler all are on the same machine.
– Chetan Ranpariya
Nov 22 '18 at 4:18
Do you have tested it in the browser(postman) and return the result correctly? which authentication you used for connecting the SQL server? try to use SQL Server Authentication.
– Abraham Qian
Nov 22 '18 at 6:57
I found the exception, it wasLogin failed for user 'IIS APPPOOLWCFService
And a search lead me to the accepted answer to this question which solved the problem, stackoverflow.com/questions/7698286/… Accept I added the login forIIS APPPOOLWCFService
instead ofasp-net
on the answer.
– inDepth
Nov 22 '18 at 7:36
add a comment |
I am using fiddler to test my web service. It connects to a SQL server database (that is connected and running) The get works on local host and through IIS Express in VS 2017. On IIS, the server works except for the GET request through fiddler. Please let me know if you need to see my Service1.svc
file (To much code not enough text error) I have tried all other answers
web.config
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<!--<behavior>
To avoid disclosing metadata information, set the values below to false before deployment
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior> -->
<bindings>
<webHttpBinding>
<binding name="restLargeBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed">
<readerQuotas maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="myWebEndPointBehaviour">
<webHttp automaticFormatSelectionEnabled="true" defaultBodyStyle="Bare" defaultOutgoingResponseFormat="Json" helpEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="myServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TestWcfService.Service1" behaviorConfiguration="myServiceBehaviour">
<endpoint address="" contract="TestWcfService.IService1" binding="webHttpBinding" bindingConfiguration="restLargeBinding" behaviorConfiguration="myWebEndPointBehaviour"></endpoint>
<endpoint address="mex" contract="TestWcfService.IService1" binding="mexHttpBinding" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
IService1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace TestWcfService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{
// TODO: Add your service opperations here
// Get Method
[OperationContract]
[WebGet(UriTemplate = "GetUserName")]
List<UserName> GetUserName();
// Post Method
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "AddUser", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
int AddUser(string user);
}
[DataContract]
public class UserName
{
string user;
[DataMember]
public string User
{
get { return user; }
set { user = value; }
}
}
}
c# wcf iis get fiddler
I am using fiddler to test my web service. It connects to a SQL server database (that is connected and running) The get works on local host and through IIS Express in VS 2017. On IIS, the server works except for the GET request through fiddler. Please let me know if you need to see my Service1.svc
file (To much code not enough text error) I have tried all other answers
web.config
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1"/>
</system.web>
<system.serviceModel>
<!--<behavior>
To avoid disclosing metadata information, set the values below to false before deployment
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior> -->
<bindings>
<webHttpBinding>
<binding name="restLargeBinding" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed">
<readerQuotas maxStringContentLength="2147483647"/>
</binding>
</webHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="myWebEndPointBehaviour">
<webHttp automaticFormatSelectionEnabled="true" defaultBodyStyle="Bare" defaultOutgoingResponseFormat="Json" helpEnabled="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="myServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TestWcfService.Service1" behaviorConfiguration="myServiceBehaviour">
<endpoint address="" contract="TestWcfService.IService1" binding="webHttpBinding" bindingConfiguration="restLargeBinding" behaviorConfiguration="myWebEndPointBehaviour"></endpoint>
<endpoint address="mex" contract="TestWcfService.IService1" binding="mexHttpBinding" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
<!--
To browse web app root directory during debugging, set the value below to true.
Set to false before deployment to avoid disclosing web app folder information.
-->
<directoryBrowse enabled="true"/>
</system.webServer>
IService1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
namespace TestWcfService
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{
// TODO: Add your service opperations here
// Get Method
[OperationContract]
[WebGet(UriTemplate = "GetUserName")]
List<UserName> GetUserName();
// Post Method
[OperationContract]
[WebInvoke(Method = "POST", UriTemplate = "AddUser", BodyStyle = WebMessageBodyStyle.WrappedRequest, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
int AddUser(string user);
}
[DataContract]
public class UserName
{
string user;
[DataMember]
public string User
{
get { return user; }
set { user = value; }
}
}
}
c# wcf iis get fiddler
c# wcf iis get fiddler
edited Nov 27 '18 at 18:00
inDepth
asked Nov 22 '18 at 3:20
inDepthinDepth
639
639
Can you debug the wcf service?
– Chetan Ranpariya
Nov 22 '18 at 4:09
I could, but I do not get an error in visual studio, only on fiddler
– inDepth
Nov 22 '18 at 4:11
1
I would suggest to write proper exception handling in your code and write the error and exception detail in some log file. So that you can know what exact error you are getting. The Fiddler screen capture you share does not say anything about the error message. So not sure what could be the issue. I assume there that the Visual Studio, IIS and the fiddler all are on the same machine.
– Chetan Ranpariya
Nov 22 '18 at 4:18
Do you have tested it in the browser(postman) and return the result correctly? which authentication you used for connecting the SQL server? try to use SQL Server Authentication.
– Abraham Qian
Nov 22 '18 at 6:57
I found the exception, it wasLogin failed for user 'IIS APPPOOLWCFService
And a search lead me to the accepted answer to this question which solved the problem, stackoverflow.com/questions/7698286/… Accept I added the login forIIS APPPOOLWCFService
instead ofasp-net
on the answer.
– inDepth
Nov 22 '18 at 7:36
add a comment |
Can you debug the wcf service?
– Chetan Ranpariya
Nov 22 '18 at 4:09
I could, but I do not get an error in visual studio, only on fiddler
– inDepth
Nov 22 '18 at 4:11
1
I would suggest to write proper exception handling in your code and write the error and exception detail in some log file. So that you can know what exact error you are getting. The Fiddler screen capture you share does not say anything about the error message. So not sure what could be the issue. I assume there that the Visual Studio, IIS and the fiddler all are on the same machine.
– Chetan Ranpariya
Nov 22 '18 at 4:18
Do you have tested it in the browser(postman) and return the result correctly? which authentication you used for connecting the SQL server? try to use SQL Server Authentication.
– Abraham Qian
Nov 22 '18 at 6:57
I found the exception, it wasLogin failed for user 'IIS APPPOOLWCFService
And a search lead me to the accepted answer to this question which solved the problem, stackoverflow.com/questions/7698286/… Accept I added the login forIIS APPPOOLWCFService
instead ofasp-net
on the answer.
– inDepth
Nov 22 '18 at 7:36
Can you debug the wcf service?
– Chetan Ranpariya
Nov 22 '18 at 4:09
Can you debug the wcf service?
– Chetan Ranpariya
Nov 22 '18 at 4:09
I could, but I do not get an error in visual studio, only on fiddler
– inDepth
Nov 22 '18 at 4:11
I could, but I do not get an error in visual studio, only on fiddler
– inDepth
Nov 22 '18 at 4:11
1
1
I would suggest to write proper exception handling in your code and write the error and exception detail in some log file. So that you can know what exact error you are getting. The Fiddler screen capture you share does not say anything about the error message. So not sure what could be the issue. I assume there that the Visual Studio, IIS and the fiddler all are on the same machine.
– Chetan Ranpariya
Nov 22 '18 at 4:18
I would suggest to write proper exception handling in your code and write the error and exception detail in some log file. So that you can know what exact error you are getting. The Fiddler screen capture you share does not say anything about the error message. So not sure what could be the issue. I assume there that the Visual Studio, IIS and the fiddler all are on the same machine.
– Chetan Ranpariya
Nov 22 '18 at 4:18
Do you have tested it in the browser(postman) and return the result correctly? which authentication you used for connecting the SQL server? try to use SQL Server Authentication.
– Abraham Qian
Nov 22 '18 at 6:57
Do you have tested it in the browser(postman) and return the result correctly? which authentication you used for connecting the SQL server? try to use SQL Server Authentication.
– Abraham Qian
Nov 22 '18 at 6:57
I found the exception, it was
Login failed for user 'IIS APPPOOLWCFService
And a search lead me to the accepted answer to this question which solved the problem, stackoverflow.com/questions/7698286/… Accept I added the login for IIS APPPOOLWCFService
instead of asp-net
on the answer.– inDepth
Nov 22 '18 at 7:36
I found the exception, it was
Login failed for user 'IIS APPPOOLWCFService
And a search lead me to the accepted answer to this question which solved the problem, stackoverflow.com/questions/7698286/… Accept I added the login for IIS APPPOOLWCFService
instead of asp-net
on the answer.– inDepth
Nov 22 '18 at 7:36
add a comment |
1 Answer
1
active
oldest
votes
I needed to find the proper exception message. There are a couple different ways to do it, but the easiest in this case was to use fiddler (because the error was caused while using it). All I needed to do was paste the Uri I was using for the GET request and paste it in the browser. This gave me the exception and the trace details. I then used the exception message Login failed for user 'IIS APPPOOLWCFService
to search for an answer. The accepted answer on this question Login failed for user 'IIS APPPOOLASP.NET v4.0' is the solution (the login may or not slightly differ depending on exact error code and service that you are using)
Hope this helps someone else out there.
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423399%2fhttp-400-bad-request-on-method-get-request-for-wcfservice%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
I needed to find the proper exception message. There are a couple different ways to do it, but the easiest in this case was to use fiddler (because the error was caused while using it). All I needed to do was paste the Uri I was using for the GET request and paste it in the browser. This gave me the exception and the trace details. I then used the exception message Login failed for user 'IIS APPPOOLWCFService
to search for an answer. The accepted answer on this question Login failed for user 'IIS APPPOOLASP.NET v4.0' is the solution (the login may or not slightly differ depending on exact error code and service that you are using)
Hope this helps someone else out there.
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
add a comment |
I needed to find the proper exception message. There are a couple different ways to do it, but the easiest in this case was to use fiddler (because the error was caused while using it). All I needed to do was paste the Uri I was using for the GET request and paste it in the browser. This gave me the exception and the trace details. I then used the exception message Login failed for user 'IIS APPPOOLWCFService
to search for an answer. The accepted answer on this question Login failed for user 'IIS APPPOOLASP.NET v4.0' is the solution (the login may or not slightly differ depending on exact error code and service that you are using)
Hope this helps someone else out there.
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
add a comment |
I needed to find the proper exception message. There are a couple different ways to do it, but the easiest in this case was to use fiddler (because the error was caused while using it). All I needed to do was paste the Uri I was using for the GET request and paste it in the browser. This gave me the exception and the trace details. I then used the exception message Login failed for user 'IIS APPPOOLWCFService
to search for an answer. The accepted answer on this question Login failed for user 'IIS APPPOOLASP.NET v4.0' is the solution (the login may or not slightly differ depending on exact error code and service that you are using)
Hope this helps someone else out there.
I needed to find the proper exception message. There are a couple different ways to do it, but the easiest in this case was to use fiddler (because the error was caused while using it). All I needed to do was paste the Uri I was using for the GET request and paste it in the browser. This gave me the exception and the trace details. I then used the exception message Login failed for user 'IIS APPPOOLWCFService
to search for an answer. The accepted answer on this question Login failed for user 'IIS APPPOOLASP.NET v4.0' is the solution (the login may or not slightly differ depending on exact error code and service that you are using)
Hope this helps someone else out there.
answered Nov 22 '18 at 7:44
inDepthinDepth
639
639
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
add a comment |
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
Yes, thank you for sharing the progress. I start to think it is the authentication problem of database connection. If you try to specify the connection string using SQL server authentication, I don't think there will be such problem.
– Abraham Qian
Nov 23 '18 at 2:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53423399%2fhttp-400-bad-request-on-method-get-request-for-wcfservice%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you debug the wcf service?
– Chetan Ranpariya
Nov 22 '18 at 4:09
I could, but I do not get an error in visual studio, only on fiddler
– inDepth
Nov 22 '18 at 4:11
1
I would suggest to write proper exception handling in your code and write the error and exception detail in some log file. So that you can know what exact error you are getting. The Fiddler screen capture you share does not say anything about the error message. So not sure what could be the issue. I assume there that the Visual Studio, IIS and the fiddler all are on the same machine.
– Chetan Ranpariya
Nov 22 '18 at 4:18
Do you have tested it in the browser(postman) and return the result correctly? which authentication you used for connecting the SQL server? try to use SQL Server Authentication.
– Abraham Qian
Nov 22 '18 at 6:57
I found the exception, it was
Login failed for user 'IIS APPPOOLWCFService
And a search lead me to the accepted answer to this question which solved the problem, stackoverflow.com/questions/7698286/… Accept I added the login forIIS APPPOOLWCFService
instead ofasp-net
on the answer.– inDepth
Nov 22 '18 at 7:36