I have a WCF service hosted in IIS 5.1 on my development XP machine. The service cannot connect to sql server DB with integrated security=true. The same service works fine when hosted in a console app. I have unchecked Anonymous access and checked the Integrated Windows Authentication in IIS
These are my setting in Web.Config
<connectionStrings>
<add name="CADISEntities" connectionString="metadata=res://*/UDI.CADISEntities.csdl|res://*/UDI.CADISEntities.ssdl|res://*/UDI.CADISEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=DBSQLP404;Initial Catalog=CadisCustom;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
I have tried changing to Integrated security to SSPI and Trusted Connection =Yes, but no luck. Below is the Config settings.
<service behaviorConfiguration="CADISBehaviour" name="GlobalInvestors.FIPA.BLL.UDI.CADISSecurities">
<endpoint binding="basicHttpBinding" bindingConfiguration="CADISBinding"
contract="GlobalInvestors.FIPA.BLL.UDI.ICADISSecurities" />
</service>
<basicHttpBinding>
<binding name="CADISBinding" closeTimeout="01:30:00" openTimeout="01:30:00"
receiveTimeout="01:30:00" sendTimeout="01:30:00" maxBufferSize="65536000"
maxBufferPoolSize="52428800" maxReceivedMessageSize="65536000">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm" />
</security>
</binding>
</basicHttpBinding>
and in client
<endpoint address="http://ainaost4.amerus.corp.tld/FIPA/BLLHost/CADIS.svc"
behaviorConfiguration="Behavior" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_ICADISSecurities" contract="CADISEntities.ICADISSecurities"
name="BasicHttpBinding_ICADISSecurities">
<!--<identity>
<userPrincipalName value="AINAOST4\ASPNET" />
</identity>-->
</endpoint>
<binding name="BasicHttpBinding_ICADISSecurities" closeTimeout="01:30:00"
openTimeout="01:30:00" receiveTimeout="01:30:00" sendTimeout="01:30:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360000" maxBufferPoolSize="655360000" maxReceivedMessageSize="655360000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Ntlm" proxyCredentialType="Ntlm"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
Without setting Impersonation in the code I get "The underlying provider failed on Open" setting Impersonation in the code and I get "Cannot Initialize SSPI"
[OperationBehavior(Impersonation = ImpersonationOption.Required)]
Tried googling and found that Application pool cannot be set in IIS 5.1.
Any suggestion to fix the issue would be greatly appreciated.
fixed the issue by giving fully qualified sql server name in the connection string
Related
I am able to implement a connected service in a console app via the service reference option in VS using a wsdl. The following configuration changes are required in the app.config for the service to work:
<system.serviceModel>
<bindings>
<customBinding>
<binding name="......">
<security enableUnsecuredResponse="true" authenticationMode="MutualCertificate" allowSerializedSigningTokenOnReply="true" includeTimestamp="false" messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10" requireSignatureConfirmation="false">
<localClientSettings maxClockSkew="00:10:00" detectReplays="false" />
<localServiceSettings maxClockSkew="00:10:00" detectReplays="false" />
<secureConversationBootstrap>
<localClientSettings detectReplays="false" />
<localServiceSettings detectReplays="false" />
</secureConversationBootstrap>
<issuedTokenParameters useStrTransform="true"></issuedTokenParameters>
</security>
<textMessageEncoding messageVersion="Soap11" />
<httpsTransport maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" requireClientCertificate="true">
</httpsTransport>
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="...." binding="...." behaviorConfiguration="....." bindingConfiguration="....." contract="...." name="...." />
</client>
<behaviors>
<endpointBehaviors>
<behavior name="....">
<clientCredentials>
<serviceCertificate>
<defaultCertificate storeLocation="..." storeName="..." findValue="...." x509FindType="FindBySerialNumber" />
<authentication certificateValidationMode="None" revocationMode="NoCheck" />
</serviceCertificate>
</clientCredentials>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
When I using the same wsdl to setup a connected service in an Azure Function via WCF Web Service Reference the result does not an app.config. How do I implement the app.config above in the Azure Function connected service?
You can use the svcutil tool to generate proxy classes and config files and add them to your project to implement calls.
I have an asp.net application hosted on a VM with IIS. Now I would like host the same application in Azure App Services. We had IIS settings modified like Connection Time-out.
How do set Connection Time-out value for Azure App Services
If you want to edit the connectionTimeout setting under system.applicationHost, you could modify the applicationhost.config file. You could create it manually or use IISManager to create the file and modify it.
Here is the sample:
<system.applicationHost>
<sites>
<siteDefaults>
<logFile logFormat="W3C"
directory="%SystemDrive%\inetpub\logs\LogFiles"
enabled="true" />
<traceFailedRequestsLogging enabled="true"
directory="%SystemDrive%\inetpub\logs\FailedReqLogFiles"
maxLogFiles="20" />
<limits connectionTimeout="00:01:00" />
<ftpServer serverAutoStart="true" />
<bindings>
<binding protocol="http" bindingInformation="127.0.0.1:8080:" />
</bindings>
</siteDefaults>
</sites>
</system.applicationHost>
Hi i am calling a asmx web service in my MVC project. Everything working fine on my development environment but after publishing my project i get the error "The HTTP request was forbidden with client authentication scheme 'Anonymous'". I tried a lot of methots on th internet bu they did'nt work. You can see my config down below and many thanks for help.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="FastApiSoap">
<security mode="Transport">
<transport clientCredentialType=""/>
</security>
</binding>
</basicHttpBinding>
<customBinding>
<binding name="FastApiSoap12">
<textMessageEncoding messageVersion="Soap12" />
<httpTransport />
</binding>
</customBinding>
</bindings>
<client>
<endpoint address="http://fastsms.codec.com.tr/FastApi.asmx"
binding="basicHttpBinding" bindingConfiguration="FastApiSoap"
contract="SmsServices.FastApiSoap" name="FastApiSoap" />
<endpoint address="http://fastsms.codec.com.tr/FastApi.asmx"
binding="customBinding" bindingConfiguration="FastApiSoap12"
contract="SmsServices.FastApiSoap" name="FastApiSoap12" />
</client>
</system.serviceModel>
I found the solition. it was a bug, you can find fix on https://support.microsoft.com/en-us/help/2801679/ssl-tls-communication-problems-after-you-install-kb-931125
I Have 2 WCF-Self-Hosted Aplications done with mono. One is on Windows 8 and the other is on Ubuntu Linux. When i put both applications under Windows8 or Ubuntu, they communicate fine. When i put them apart, one in windows and one in Linux, i get a "System.IO.IOException: Read Failure ---> System.Net.Sockets.SocketException: Connection reset by peer.
I've read every single page i could find about this error with no luck on how to fix it.
i attack bellow the app.config of both apps. They communicate using net.TCP and the svcutil worked fine pulling the metadata.
CLIENT App.config (This one tries to pull data from the other, and when he collects the data, calls a 3rd Not-Implemented Yet service. )
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_IMiServicio" >
<security mode="None"/>
</binding>
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://192.168.1.101:8090/ProyectoDistribuidoTCP"
binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMiServicio"
contract="IMiServicio" name="NetTcpBinding_IMiServicio">
<identity>
<userPrincipalName value="ALEXMAINGEAR\Alex" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
SERVER App.config (this one serves the data to the second service)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<services>
<service name="ProyectoDistribuido.MiServicio" behaviorConfiguration="metadataSupport">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/ProyectoDistribuidoHTTP"/>
<add baseAddress="net.tcp://localhost:8090/ProyectoDistribuidoTCP"/>
</baseAddresses>
</host>
<endpoint binding="basicHttpBinding"
contract="ProyectoDistribuido.IMiServicio"/>
<endpoint binding="netTcpBinding"
contract="ProyectoDistribuido.IMiServicio"/>
<endpoint address= "tcpmex"
binding="mexTcpBinding"
contract="IMetadataExchange"/>
</service>
</services>
<bindings>
<netTcpBinding>
<binding name="netTcpBinding">
<security mode= "None"/>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="metadataSupport">
<serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
I know this post is rather old, but I recently found myself in a similar situation and there is still very little information on this online.
In my case, the problem was that the net.tcp binding defaults to using Windows Authentication based security.
This is fine when both services are in windows, but when one is hosted in Linux it doesn't have access to this (unless you've configured it) and the connection fails.
The error message definitely leaves something to be desired!
Here's the config I used to disable security (as I don't need it yet) with net.tcp binding.
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="bindingConfig">
<security mode="None">
<transport clientCredentialType="None" protectionLevel="EncryptAndSign" />
<message clientCredentialType="None" algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>
</bindings>
<!-- remainder of system.serviceModel -->
Note: You need to configure your service client to disable security as well. In my case, my client didn't have a .config file so I had to do it in code:
var binding = new NetTcpBinding()
{
MaxBufferSize = int.MaxValue,
ReaderQuotas = System.Xml.XmlDictionaryReaderQuotas.Max,
MaxReceivedMessageSize = int.MaxValue,
Security = new NetTcpSecurity()
{
Message = new MessageSecurityOverTcp()
{
ClientCredentialType = MessageCredentialType.None
},
Transport = new TcpTransportSecurity()
{
ClientCredentialType = TcpClientCredentialType.None
},
Mode = SecurityMode.None
}
};
I have following code (for Microsoft Translator)
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_LanguageService" 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://api.microsofttranslator.com/V2/soap.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_LanguageService" contract="TranslatorService.LanguageService" name="BasicHttpBinding_LanguageService" />
</client>
</system.serviceModel>
It was in web.config and working well. Now I need to put some translate function to Azure Worker Role, so I got error Could not find default endpoint element that references contract 'TranslatorService.LanguageService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.
I already found solution is to put above settings to ServiceConfiguration.cscfg, but how? I tried many location but all error and cannot deploy. Please help
The ServiceConfiguration.cscfg can only contain Azure specific configuration (like number of instances, configuration settings, thumbprints, ...).
Whenever you need to do regular .NET configuration (like WCF for example) you can simply create an app.config for your worker role as if you would for a console application and put your configuration in here. Note that the sample configuration in your question isn't complete if you want to add it in the app.config. You should wrap this around it:
<?xml version="1.0"?>
<configuration>
...
</configuration>