Running WCF service host inside browser
I have a sample project for a ReST service in WCF. And I am just trying to debug it. When I start the debugging however, the service always starts inside "WCF Test Client" tool. Instead, I am looking for the host to run inside the browser, so that I can download WSDL file.
I have tried removing the "Start options" in the project properties. Then instead of WCF Test Client, service opens in WCF Self Host. If I try to use postman to call the service with WCF Self Host enabled, then execution never reaches the code, and just throws 400 error code.
I also tried attaching the debugger to Chrome, and that did nothing. I have no idea what I am missing in the configuration or Visual studio options. I am expecting that when I start the debugging, it opens a new tab in the browser with the base address of the service.
Below is my current config file.
<system.web>
<compilation debug="true" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<services>
<service name="WellacyMobileAPI.Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/WellacyMobileAPI/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="WellacyMobileAPI.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="serviceBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization serviceAuthorizationManagerType="WellacyMobileAPI.RestAuthorizationManager, WellacyMobileAPI" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
wcf
add a comment |
I have a sample project for a ReST service in WCF. And I am just trying to debug it. When I start the debugging however, the service always starts inside "WCF Test Client" tool. Instead, I am looking for the host to run inside the browser, so that I can download WSDL file.
I have tried removing the "Start options" in the project properties. Then instead of WCF Test Client, service opens in WCF Self Host. If I try to use postman to call the service with WCF Self Host enabled, then execution never reaches the code, and just throws 400 error code.
I also tried attaching the debugger to Chrome, and that did nothing. I have no idea what I am missing in the configuration or Visual studio options. I am expecting that when I start the debugging, it opens a new tab in the browser with the base address of the service.
Below is my current config file.
<system.web>
<compilation debug="true" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<services>
<service name="WellacyMobileAPI.Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/WellacyMobileAPI/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="WellacyMobileAPI.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="serviceBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization serviceAuthorizationManagerType="WellacyMobileAPI.RestAuthorizationManager, WellacyMobileAPI" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
wcf
add a comment |
I have a sample project for a ReST service in WCF. And I am just trying to debug it. When I start the debugging however, the service always starts inside "WCF Test Client" tool. Instead, I am looking for the host to run inside the browser, so that I can download WSDL file.
I have tried removing the "Start options" in the project properties. Then instead of WCF Test Client, service opens in WCF Self Host. If I try to use postman to call the service with WCF Self Host enabled, then execution never reaches the code, and just throws 400 error code.
I also tried attaching the debugger to Chrome, and that did nothing. I have no idea what I am missing in the configuration or Visual studio options. I am expecting that when I start the debugging, it opens a new tab in the browser with the base address of the service.
Below is my current config file.
<system.web>
<compilation debug="true" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<services>
<service name="WellacyMobileAPI.Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/WellacyMobileAPI/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="WellacyMobileAPI.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="serviceBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization serviceAuthorizationManagerType="WellacyMobileAPI.RestAuthorizationManager, WellacyMobileAPI" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
wcf
I have a sample project for a ReST service in WCF. And I am just trying to debug it. When I start the debugging however, the service always starts inside "WCF Test Client" tool. Instead, I am looking for the host to run inside the browser, so that I can download WSDL file.
I have tried removing the "Start options" in the project properties. Then instead of WCF Test Client, service opens in WCF Self Host. If I try to use postman to call the service with WCF Self Host enabled, then execution never reaches the code, and just throws 400 error code.
I also tried attaching the debugger to Chrome, and that did nothing. I have no idea what I am missing in the configuration or Visual studio options. I am expecting that when I start the debugging, it opens a new tab in the browser with the base address of the service.
Below is my current config file.
<system.web>
<compilation debug="true" />
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
</providers>
</roleManager>
</system.web>
<system.serviceModel>
<services>
<service name="WellacyMobileAPI.Service">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8733/WellacyMobileAPI/" />
</baseAddresses>
</host>
<endpoint address="" binding="basicHttpBinding" contract="WellacyMobileAPI.IService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="serviceBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceAuthorization serviceAuthorizationManagerType="WellacyMobileAPI.RestAuthorizationManager, WellacyMobileAPI" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
wcf
wcf
edited Nov 20 at 9:27
asked Nov 20 at 7:02
jitendragarg
313732
313732
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The reason why the WCF test client is started by default when debugging the WCF Service is that the browser doesn’t support SOAP message. it means that not all WCF services are http-mode WCF service, so that the browser could not trigger the other WCF service, which communicates with the client via the other binding and message format.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
1
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
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%2f53387800%2frunning-wcf-service-host-inside-browser%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
The reason why the WCF test client is started by default when debugging the WCF Service is that the browser doesn’t support SOAP message. it means that not all WCF services are http-mode WCF service, so that the browser could not trigger the other WCF service, which communicates with the client via the other binding and message format.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
1
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
add a comment |
The reason why the WCF test client is started by default when debugging the WCF Service is that the browser doesn’t support SOAP message. it means that not all WCF services are http-mode WCF service, so that the browser could not trigger the other WCF service, which communicates with the client via the other binding and message format.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
1
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
add a comment |
The reason why the WCF test client is started by default when debugging the WCF Service is that the browser doesn’t support SOAP message. it means that not all WCF services are http-mode WCF service, so that the browser could not trigger the other WCF service, which communicates with the client via the other binding and message format.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api
The reason why the WCF test client is started by default when debugging the WCF Service is that the browser doesn’t support SOAP message. it means that not all WCF services are http-mode WCF service, so that the browser could not trigger the other WCF service, which communicates with the client via the other binding and message format.
https://docs.microsoft.com/en-us/dotnet/framework/wcf/wcf-and-aspnet-web-api
answered Nov 20 at 8:50
Abraham Qian
58616
58616
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
1
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
add a comment |
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
1
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
Ok. So, that means somewhere in my config file, there is configuration for SOAP? Wait, let me add the config file into the question.
– jitendragarg
Nov 20 at 9:25
1
1
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
you want to publish the service as a restful service? you should change the basichttpbinding to webhttpbinding and apply the webhttp behavior to the endpoint.stackoverflow.com/questions/53200663/…
– Abraham Qian
Nov 21 at 3:24
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
Awesome. Thanks. It was the problem. I had the binding created as webhttp, but didn't change that in the actual endpoint.
– jitendragarg
Nov 21 at 6:25
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f53387800%2frunning-wcf-service-host-inside-browser%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