Lately in all my new web applications I have been adding web services as service references rather than web references. Most of our web services were designed as asmx web services.
After adding the service reference my web.config always looks like this:
<bindings>
<basicHttpBinding>
<binding name="UserSoap" />
</basicHttpBinding>
<customBinding>
<binding name="UserSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="{{service URL}}" binding="basicHttpBinding"
bindingConfiguration="UserSoap" contract="User.UserSoap"
name="UserSoap" />
<endpoint address="{{service URL}}" binding="customBinding"
bindingConfiguration="UserSoap12" contract="User.UserSoap"
name="UserSoap12" />
</client>
Then my application gives this error when I try to consume it:
An endpoint configuration section for contract 'User.UserSoap' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name.
I have been manually removing one of the endpoints, but now I want to know how to fix this.
Any ideas on how I can prevent this from happening, or why is this happening?
If you want to remove SOAP 1.2 support for your service, you would include the following in your web.config:
<configuration>
<system.web>
<webServices >
<protocols>
<remove name="HttpSoap12"/>
</protocols>
</webServices>
</system.web>
</configuration>
Add or remove SOAP 1.2 for ASMX services
Otherwise, you'll need to access with endpoint name.
var service = new User.UserSoapClient("UserSoap")
Related
So I have a web service service reference that works localhost and can be pinged from its production url but I can't get access to it via the Service Reference call in production. I believe the issue is my firewall . I have two websites on the same server each with their own dedicated IP address. I am trying to call the web service on the second website from the first website. If I open a browser on my production server I cannot navigate to either website.
Error Description:There was no endpoint listening at http://[209.112.245.103]/Services/OfferService.asmx that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
Inner Exception:Unable to connect to the remote server
The calling website is on the same server (different IP of course) and is calling the web service via a service reference:
Dim offerService As New ServiceReferenceOffer.OfferServiceSoapClient("OfferServiceSoap")
offerService.BroadcastOfferChange(offer.PropertyID, offer.OfferID, offer.ResultResponse)
And my web.config contains the following service endpoint information:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="OfferServiceSoap" />
<binding name="ConversationServiceSoap" />
</basicHttpBinding>
<customBinding>
<binding name="OfferServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
<binding name="ConversationServiceSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://209.112.245.103/Services/ConversationService.asmx"
binding="basicHttpBinding" bindingConfiguration="ConversationServiceSoap"
contract="ServiceReferenceConversation.ConversationServiceSoap"
name="ConversationServiceSoap" />
<endpoint address="http://209.112.245.103/Services/ConversationService.asmx"
binding="customBinding" bindingConfiguration="ConversationServiceSoap12"
contract="ServiceReferenceConversation.ConversationServiceSoap"
name="ConversationServiceSoap12" />
<endpoint address="http://209.112.245.103/Services/OfferService.asmx"
binding="basicHttpBinding" bindingConfiguration="OfferServiceSoap"
contract="ServiceReferenceOffer.OfferServiceSoap" name="OfferServiceSoap" />
<endpoint address="http://209.112.245.103/Services/OfferService.asmx"
binding="customBinding" bindingConfiguration="OfferServiceSoap12"
contract="ServiceReferenceOffer.OfferServiceSoap" name="OfferServiceSoap12" />
</client>
</system.serviceModel>
Your configurations are correct. I just accessed your server and everything went fine (so it's not code related).
Since the site and the website are in the same server, you may need to use a different IP or address to access the wcf (try 127.0.0.1, localhost or an internal server ip).
I have a web application which enables users to upload files. The files are then saved using a WCF service on another service. This uploading works fine until I upload a file around 4.5 MB. When I upload a file above a certain size, I get the error:
Soap Error: 413 The server is refusing to process a request because the request entity is larger than the server is willing or able to process...
This error appears in the system event log of the server on which the WCF service is running.
The solutions that I've found have told me to change the maxAllowedContentLength and uploadReadAheadSize settings in the applicationHost config file. However changing the maxAllowedContentLength to only created a different error if I set it to something really small and changing the uploadReadAheadSize value didn't have any effect on the problem. Does anyone know what I have to change and where I have to change it? I've been looking for hours and I'm starting to get impatient :(. Thanks for the help!
EDIT:
Ok the web.config of the WCF Service located in the on the production system is as follows. This is the web.config located in the folder that the IIS Site of the WCF Web Services points to:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="SOAP" path="*.wsdl" verb="*" modules="IsapiModule" scriptProcessor="C:\Program Files (x86)\Common Files\MSSoap\Binaries\SOAPIS30.dll" resourceType="Unspecified" preCondition="bitness32" />
<add name="WSDL Mapping" path="*.wsdl" verb="*" modules="IsapiModule" scriptProcessor="C:\Program Files\Common Files\MSSoap\Binaries\SOAPIS30.dll" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
The configuration on the test system is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="WSDL Mapping" path="*.wsdl" verb="*" modules="IsapiModule" scriptProcessor="C:\Program Files\Common Files\MSSoap\Binaries\SOAPIS30.dll" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
As you can see, there is no mention of any content length or anything in either one of the files. I have to admit, I'm pretty stumped at this point. But like I said, I'm no expert in things IIS.
EDIT 2:
Here is the serviceModel node of my web application's web.config:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="WsJobsSoapBinding" closeTimeout="00:05:00" openTimeout="00:05:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384"/>
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None" realm=""/>
<message clientCredentialType="UserName" algorithmSuite="Default"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://srvts01test:90/WsJobs.WSDL" binding="basicHttpBinding" bindingConfiguration="WsJobsSoapBinding" contract="JobsWs.WsJobsSoapPort" name="WsJobsSoapPort"/>
</client>
</system.serviceModel>
This is the web.config of my web application that calls the WCF service and not the web.config of the WCF service itself. Thanks again for any help :)
I found an article that talks about the 45KB size limit you mentioned in the chat. It includes the configuration changes that were made.
http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
It's possible that your test environment has these changes made so that's one thing to look for/consider. People sometimes don't overwrite configuration files during deployment so you may have an old file there that just works.
You want to change the MaxReceivedMessageSize.
I think when I did this I also had to change the MaxBufferPoolSize to the same value.
You can do it via the config or via code like this.
binding.MaxBufferPoolSize = 67108864;
binding.MaxReceivedMessageSize = 67108864;
I was also having these 413 errors in my WCF Service, which was running under .Net 4.5.
The solution was simple.
Previously, my web.config contained this:
<services>
<service name="PocketCRMServices.Service1">
<endpoint address="../Service1.svc"
binding="webHttpBinding"
contract="PocketCRMServices.IService1"
behaviorConfiguration="webBehaviour" />
</service>
</services>
So, by default, it was already using the webHttpBinding binding.
To get rid of the 413 errors, I just needed to add this straight after this section:
<bindings>
<webHttpBinding>
<binding maxReceivedMessageSize="2147483647"
maxBufferPoolSize="2147483647777" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
</binding>
</webHttpBinding>
</bindings>
And that's it.
From my silverlight 4.0 application. I can access the WCF File easily but when moved to https, I can't access the WCF Service. The error details are following:
An unknown error occurred. Please contact your system Administrator for more information.
An exception occurred during the operation, making the result invalid. Check InnerException for exception details.
at System.ComponentModel.AsyncCompletedEventArgs.RaiseExceptionIfNecessary()
at FileSearch.SearchServices.GetTypeofFileDetailedCompletedEventArgs.get_Result()
at FileSearch.Home.<SearchButton_Click>b__0(Object s, GetTypeofFileDetailedCompletedEventArgs ea)
at FileSearch.SearchServices.SearchServiceClient.OnGetTypeofFileDetailedCompleted(Object state)
I have seen different posts regarding this issue, but nothing is pointing me in a proper direction.
Here are the details regarding my web.config file for the web application that hosts the silverlight application as well as the WCF Service.
<services>
<service name="FileSearch.Web.Services.SearchService">
<endpoint address="" binding="customBinding" bindingConfiguration="FileSearch.Web.Services.SearchService.customBinding0" contract="FileSearch.Web.Services.SearchService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
and here is the servicerefernce.clientconfig file:
<configuration>
<system.serviceModel>
<bindings>
<customBinding>
<binding name="CustomBinding_SearchService">
<binaryMessageEncoding />
<httpTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="../Services/SearchService.svc"
binding="customBinding" bindingConfiguration="CustomBinding_SearchService"
contract="SearchServices.SearchService" name="CustomBinding_SearchService" />
</client>
</system.serviceModel>
</configuration>
UPDATE:
I've received answers to run the service in the https mode only. I want to run the service in both http and https modes.
any ideas regarding this ?
Specify two endpoints one with secured transport and one without it.
try adding
<security mode="Transport" />
in you service config file. this should be nested inside the binding node.
Check out the security mode configuration section in this article.
For supporting Https scheme, you'd need to change transport to <httpsTransport>. I see you're using <httpTransport>.
Background: I am getting a Internal Server 500 24 50 error after deploying an application that has compiled without errors on my local machine. The server that the application is deployed on has a ton of security and is running IIS 7.5 so I need to specify read and write access for every directory. This application uses windows authentication and a web service to populate drop down boxes via a proxy. I think there might be an issue connecting to the web service or an issue with the read/write security on the files, or an issue with the active directory authentication.
For some reason, Internet Explorer just displayed can't load webpage Error.
Error in Google Chrome:
500 – Internal Server Error.
There is a problem with the resource you are looking for, and it cannot be displayed.
Log File Details:
#Software: Microsoft Internet Information Services 7.5
#Fields: date time s-sitename s-computername s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-version cs(User-Agent) cs(Cookie) cs(Referer) cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken
2011-05-18 13:54:46 W3SVC1 FL-TPA-WEB-01 172.17.1.25 GET / - 80 -
172.17.1.25 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;
+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET4.0C;+.NET4.0E) - -
invitations.myagencyservices.com 500 24 50 1380 368 15
MSDN Defines the error at http://support.microsoft.com/kb/943891 as:
500.24 - An ASP.NET impersonation configuration does not apply in Managed
Pipeline mode.
Web.Config code:
<system.web>
<customErrors mode="Off" ></customErrors>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
<trace enabled="true" pageOutput="true" />
<authentication mode="Windows"/>
<identity impersonate="true"/>
<authorization>
<allow users="alg\bmccarthy, alg\phoward" />
<allow roles="alg\ACOMP_USER_ADMIN" />
<allow roles="alg\ACOMP_user_AMG" />
<allow roles="alg\ACOMP_user_BIG" />
<allow roles="alg\ACOMP_user_NIS" />
<allow roles="alg\ACOMP_user_GLA" />
<allow roles="alg\ACOMP_user_PIP" />
<allow roles="alg\ACOMP_user_PSM" />
<allow roles="alg\ACOMP_user_PAM" />
<allow roles="alg\ACOMP_user_ANN" />
<allow roles="alg\ACOMP_user_AAM" />
<allow roles="alg\ACOMP_user_MWM" />
<allow roles="alg\ACOMP_user_GIM" />
<deny users="*" />
</authorization>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IAcompService1" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://63.236.108.91/aCompService.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IAcompService1" contract="aComp_ServiceReference.IAcompService"
name="BasicHttpBinding_IAcompService1" />
</client>
</system.serviceModel>
Any suggestions will be up-voted!
Thanks for looking!
The 500.24.50 Error occurs because ASP.NET Integrated mode is unable to impersonate the request identity in the BeginRequest and AuthenticateRequest pipeline stages. 500.24 is thrown if your application is running in integrated mode, validateIntegratedModeConfiguration is not declared or set to true, and your application has identity impersonate set to true.
Workaround
A. If your application does not rely on impersonating the requesting user in the BeginRequest and AuthenticateRequest stages (the only stages where impersonation is not possible in Integrated mode), ignore this error by adding the following to your application’s web.config:
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
B. If your application does rely on impersonation in BeginRequest and AuthenticateRequest, or you are not sure, move to Classic mode.
C. remove from web.config which won't be effective in integrated mode anyway
Read more on Breaking Changes in IIS 7 from LEARN.IIS.NET
UPDATE:
Did a little more digging and you actually have the service mis-configured. This MSDN article explains how to configure basicHttpBinding for Windows authentication. Basically, the basicHttpBinding element needs to look like this:
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
Original answer:
Below is something to try from the information in this article. Since your service uses impersonation for authorization it looks like you'll need to use the ASP.NET classic mode pipeline configuration of the AppPool for this service. You may want to research how impersonation is supported in the new Integrated mode pipeline and see why your service is failing to comply with it since Integrated mode is prefered.
You will receive a 500 - Internal
Server Error. This is HTTP Error
500.24: An ASP.NET setting has been detected that does not apply in
Integrated managed pipeline mode.
This occurs because ASP.NET Integrated
mode is unable to impersonate the
request identity in the BeginRequest
and AuthenticateRequest pipeline
stages. Workaround
B. If your
application does rely on impersonation
in BeginRequest and
AuthenticateRequest, or you are not
sure, move to Classic mode.
Important: Make sure that you have installed ASP.NET on your machine; if not or if in doubt, run the following command:
> c:\Windows\Microsoft.NET\Framework\vX.X.XXXXX\aspnet_regiis.exe /i
Hi I have been trying to solve my problem, however couldn't do anything about it.
The problem is
http://localhost/productservice/service.svc when type this address in my browser it gives me 503 Service Unavailable error
When I run my code from VS 2010 it gives me
The HTTP service located at http://localhost/ProductsService/Service.svc is too busy.
exception.
ProductService is running in the ASP.NET v4.0 integrated application pool with the ApplicationPoolIdentity.
I just got no idea what I need to do!
(Windows 7 Home & IIS7)
basicHttpBinding is used
the server side config is
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="AdventureWorksEntities" connectionString="metadata=res://*/ProductsModel.csdl|res://*/ProductsModel.ssdl|res://*/ProductsModel.msl;provider=System.Data.SqlClient;provider connection string="Data Source=PINCHY\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="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>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true"/>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
the client app.config is
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IProductsService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:80/ProductsService/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IProductsService"
contract="ProductsService.IProductsService" name="BasicHttpBinding_IProductsService" />
</client>
</system.serviceModel>
</configuration>
Any help will be much appreciated
Thanks
Had the same problem, but a different cause. In IIS (left side panel), click on Application Pools and make sure the ASP.NET version you've selected is actually running. Mine was off for some reason.
I just have the same issue. The issue for me turned out be an invalid password. My password recently changed and the app pool for IIS uses the old password. Once the password was updated the application worked again.
Hopes that help.
I also ran into the same problem and the solution is,
In IIS click on ProductsService website under default website. On the right side under actions pane click on advanced settings. Check the Enabled Protocol property the values for this property should be comma separated ex: http,net.tcp . Actually I had entered semi colon instead of comma and I used to get the same exception which you are facing. try replacing semicolon which comma. I think it should work.
Our team experienced the same issue, 503 Service Unavailable.
In our case, the application pool was fine, (the identity was set correctly and the app pool was started).
After some evaluation, we discovered a WCF based service was installed on the server that reserved port 80. Using the netsh http command we were able to see the url reservation.
netsh http show urlacl
Reserved URL : http://+:80/
The following link proved helpful:
http://blogs.msdn.com/b/webtopics/archive/2010/02/17/a-not-so-common-root-cause-for-503-service-unavailable.aspx
I kept getting the 503 error in IIS 7 running a .NET 4.0 website on localhost. I got rather smug about it because all I had to do was click on Application Pools in the left-hand pane where you see sites and application pools listed. Sure enough, the relevant application pool was always stopped and I just re-started it. However, today (the reason I came back to this question) this didn't solve the problem. In my case I have a website with some public pages, then 2 applications which are password-protected. Only one of the applications was giving the 503 error. I selected the application and clicked Advanced settings and realised that the problem was the application pool. It was pointing to the DefaultAppPool instead of the application pool for the overall website. When I corrected that, all 3 areas of the website began working normally again. So, to sum up, a 503 error may be caused by a stopped application pool. Just make sure you re-start the right application pool to get your website running again.