I have created an office shared add in using Visual Studio 2010 .NET 4.0. This add in references a WCF service. When creating an instance of the WCF service client, i get the following exception:
Could not find default endpoint element that references contract 'Services.IBusinessLogicLayerMetaData' 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 am not sure how to resolve this. My app.config looks like this:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_IBusinessLogicLayerMetaData" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="1048576000" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
<security mode="None">
<transport clientCredentialType="Windows" proxyCredentialType="None" realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://10.181.9.47:8000/DeutscheBank.WindowsServices.DataSOA/BusinessLogicLayerMetaDataService" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IBusinessLogicLayerMetaData" contract="Services.IBusinessLogicLayerMetaData" name="WSHttpBinding_IBusinessLogicLayerMetaData" />
</client>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>
Hope this helps someone.
I resolved this issue by copying the add in config file and dll to the office directory. I also made a copy of the config file and renamed it to "OfficeApplication".exe.config.
"OfficeApplication" is the office app that you would like the add in to work with.
Related
I have been battling to resolve wcf issues on our production servers. One of the errors thrown is "The server rejected the upgrade request." among other weird errors I'm receiving. Our applications runs on the Citrix environment for the front end and our application servers host our WCF Services. We have two application servers set up for load balancing and this KEMP server supports sticky ip's since we are using nettcpbinding. However, I am not sure if we have configured our NetTCP settings correctly as the application frequently uses 100% CPU, when more than 5 users log onto an application. After an iisreset, it takes about an hour for this to re-occur. Please find below the configuration of the NETTcpBinding below:
<bindings>
<netTcpBinding>
<binding name="NetTcpLargeBindingEndpoint"
closeTimeout="00:05:00"
openTimeout="00:05:00"
receiveTimeout="00:15:00"
sendTimeout="00:15:00"
transactionFlow="false"
transferMode="Buffered"
transactionProtocol="OleTransactions"
hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647"
maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647"
listenBacklog="10"
portSharingEnabled="false"
>
<reliableSession enabled="false"/>
<readerQuotas maxArrayLength="2147483647" maxStringContentLength="2147483647" />
<security mode="Transport">
<transport clientCredentialType="Windows" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</netTcpBinding>
</bindings>
I have tried searching articles for the correct settings to have for nettcpbindng, but not luck and the most helpful is this msdn article:
https://msdn.microsoft.com/en-us/library/vstudio/hh273122(v=vs.100).aspx
Is there something I'm doing wrong in these settings? Please assist
I'm having trouble with a Client-Server Application I'm developing.
I've created a Windows Form Application for the Client Part and a WCF Application for the Server part.
I'm using Visual Studio 2010. The application works just fine locally but I need to separate them. I want to run the Server application in a remote PC connected to the same LAN as the Client App.
Every time I debug my Server application, it runs at "http:/ /localhost:port" but I need it to run at "http:/ /192.168.1.xxx:port". So that I can import the services to my Client App using that address: "http:/ /192.168.1.xxx:port/Service1.svc".
I have another question. How can I export my Server Application to run it wherever I want? i.e. How to run my server app without debugging it on Visual Studio 2010?.
These are my configuration files for my services:
Client Side (app.config):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IValidacionesService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocalhostNameComparisonMode="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>
<binding name="BasicHttpBinding_IEncuestaCRUDService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="6553600" maxBufferPoolSize="52428800" maxReceivedMessageSize="6553600"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="3200" maxStringContentLength="819200" maxArrayLength="1638400"
maxBytesPerRead="409600" maxNameTableCharCount="1638400" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http:/ /localhost:2504/ValidacionesService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IValidacionesService"
contract="ServiceValidacionesReference.IValidacionesService"
name="BasicHttpBinding_IValidacionesService" />
<endpoint address="http:/ /localhost:2504/EncuestaCRUDService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IEncuestaCRUDService"
contract="ServiceEncuestaReference.IEncuestaCRUDService" name="BasicHttpBinding_IEncuestaCRUDService" />
</client>
</system.serviceModel>
Server Side (web.config):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<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="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings>
<add name="CADBEntities" connectionString="metadata=res://*/ModeloCaDB.csdl|res://*/ModeloCaDB.ssdl|res://*/ModeloCaDB.msl;provider=System.Data.SqlClient;provider connection string="data source=OMSUser\SQLEXPRESS;initial catalog=CADB;integrated security=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
Thanks in advance.
You need to host the WCF service as an IIS site on the other computer.
VS has a a couple of ways you can publish the files needed to the other machine, though the easiest way is probably via a network share.
Here's a link to the basics of publishing a WCF service.
Your client is trying to communicate with an EndpointAddress set to localhost which means the current computer.
It must be configured to contact the IP address of the machine that the WCF Service is being hosted on.
Here is an example of how you would do this in the client configuration file.
<system.serviceModel>
<client>
<endpoint address="http://192.168.1.xxx:port/Service1.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IValidacionesService"
contract="IValidacionesService" name="BasicHttpBinding_IValidacionesService">
</endpoint>
</client>
</system.serviceModel>
I have stumbled upon a great problem. Server side runs on .net with basicHttpBinding over Basic security on transport level. So here we go:
Server web.config (IIS basic auth = ON, all other = off, protocol = HTTP):
<basicHttpBinding>
<binding maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed" messageEncoding="Text">
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
In client we have same basicHttpBinding.
App.exe.config:
<basicHttpBinding>
<binding name="Default" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647" transferMode="StreamedResponse" maxBufferPoolSize="524288000" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="65536000" maxArrayLength="65536000" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
Also, I happen to know that in windows 8.1 and server 2012 R2 basicHttpBinding method is restricted to transfer credentials. So the question is what are my options? Can I avoid using SSL over https? If no, then how should my config look for https with wsHttpBinding on both sides? Any help appreciated!!
OK, you should change the line:
<transport clientCredentialType="Basic" />
to
<transport clientCredentialType="Windows" />
to use transport security with basic http binding. This link details step by step how to configure the service in IIS
I'm accessing a third party WCF service (I have no access to the service configuration) We're using SSL certificates for the authentication.
I'm getting this error when trying to access to any of the provided methods
The HTTP request is unauthorized with client authentication scheme 'Negotiate'. The
authentication header received from the server was 'Negotiate,NTLM
I checked many google links and no luck so far- No idea what else to check on my side.
EDIT
Here is the configuration
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsHttpBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Transport">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="https://url"
binding="wsHttpBinding" bindingConfiguration="wsHttpBinding"
contract="IApiWS" name="wsHttpBinding">
</endpoint>
</client>
</system.serviceModel>
Try setting your clientCredentialType="Windows" to clientCredentialType="Certificate" I usually use hard-coded WCF config, not config file, so I'm not really sure on this, but either way, take a look at the following link: Selecting a Credential Type on MSDN.
Good luck. I'm surprised what/whom you're connecting to didn't give explicit endpoint connection instructions, but hey, you deal with every kind when working with 3rd-party stuff.
Ok, this may be a little vague so I aplogise in advance, essentially the server is telling you you are not authorised, normally for this you would add something like the below onto the proxy you generated
svc.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
where svc is your generated proxy. I have also seen this on a misconfigured IIS hosted endpoint where the virtual folder does not have allow anonymous set (though you say you cannot access the service configuration so that may not be to helpful). hope this helps
edit added more info,
It may be, depending on security, that a setting similar to below may be more usefull
svc.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Anonymous;
Edit 2
The config above shows that the wsHttpBinding you are using has Windows set as clientCredentialtype for the transport security and user authentication, this mean that you will be sending through the credentials of the currently logged on user to the service for authentication using NTLM (as negotiateServiceCredentials is true) have you confirmed that the user logged on has rights on the service?
We have a .Net 3.5 Workflow hosted as a service that sometimes stops unexpectedly. This has occurred at times while it is writing a file and, most recently, when receiving a reply from another WCF service. There are no exceptions being caught, as these all get logged, and there are no messages in the event logs on the server where both are hosted. I added logging to verify that the service is completing it's logic, which it is (taking about 6 minutes). All my timeouts are far higher than they need be. I'm starting to think the issue might be that the channel is getting closed and, due to the very high timeouts, an error is not yet thrown. Of potential relevance, the workflow is calling the wcf service asynchronously and then using a WaitOne() on the AsyncWaitHandle. I have a feeling this is maybe not the best idea, but I'm not sure if it could cause this issue. Also, persistence is not set up on the workflow (I had previously thought that the unloadOnIdle setting might have been causing issues with getting return values from the called service, as I'm not very clear on how this is supposed to work).
Any help/advice would be greatly appreciated.
Have you checked the timeout settings on the client. I know in the past I had to update both the client timeout settings as well as the server settings.
In the workflow App.config (missing a timeout for the hosting of the workflow?):
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" closeTimeout="00:02:00"
openTimeout="00:02:00" receiveTimeout="04:00:00" sendTimeout="04:00:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360000" maxBufferPoolSize="2147483647" maxReceivedMessageSize="655360000"
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://url/Service.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IService"
contract="DALService.IService" name="BasicHttpBinding_IService" />
</client>
In the DalService WCF web.config:
<httpRuntime
maxRequestLength="1048576"
executionTimeout="6000000"
/>
<basicHttpBinding>
<binding name ="LargeMessageBinding"
closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="04:30:00" sendTimeout="04:30:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="655360000" maxBufferPoolSize="524288" maxReceivedMessageSize="655360000"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true"
/>
<!--maxReceivedMessageSize="6553600" -->
<!--maxBufferSize="6553600" -->
Turns out, the workflow was not being hosted in its own worker process, as I had thought. Another app was crashing the process. The WCF service was correctly configured to use its own worker process, hence it would correctly return, but to a no longer running app.