The binding at system.serviceModel/bindings/webHttpBinding does not have a configured binding named 'webBinding'. This is an invalid value for bindingConfiguration.
there is a problem with your config, possibly you are trying to use webHttpBinding but didn't define any bindingConfiguration named webBinding in the bindings section.
something like -
<webHttpBinding>
<binding name="webBinding">
</binding>
</webHttpBinding>
Related
I trying host my project, but when I run svc file then i get exception.
Exception data: System.InvalidOperationException: The convention requires the use of Session, but the "BasicHttpBinding" binding is not supported or is not configured correctly.
What could be the problem?
I tried changing the web.config file but I don't know what the problem is
You can change your binding mode from BasicHttpBinding to WsHttpBinding. Since the default binding method for HTTP is BasicHttpBinding, you can modify it in the <System.ServiceModel>:
<protocolMapping>
<add scheme="http" binding="wsHttpBinding" bindingConfiguration="WsHttpSession"/>
</protocolMapping>
This allows you to modify the binding.
I've two separate tables to log user activity and errors in asp.net web Api.
Here's my Activity Log table:
To store the Log information in the table, Here's the Nlog.config setting.
<target name="database" xsi:type="Database" keepConnection="true" useTransactions="true"
dbProvider="System.Data.SqlClient" commandType="Text"
connectionString="data source=XXXXX;initial catalog=XXXXX;integrated security=false;persist security info=True;User ID=XXXXX;Password=XXXXX"
commandText="INSERT INTO [dbo].[ActivityLog]([PageName],[MethodName],[IPAddress],[RequestedUrl],[IsAuthenticated],[UserName],[Date]) VALUES(#PageName,#MethodName,#IPAddress,#RequestedUrl,#IsAuthenticated,#UserName,#Date)">
<parameter name="#PageName" layout="" />
<parameter name="#MethodName" layout="" />
<parameter name="#IPAddress" layout=""/>
<parameter name="#RequestedUrl" layout="${aspnet-request:serverVariable=HTTP_URL}"/>
<parameter name="#IsAuthenticated" layout="${aspnet-user-identity}:isAuthenticated"/>
<parameter name="#UserName" layout="${aspnet-user-identity}"/>
<parameter name="#Date" layout="${date:s}"/>
</target>
For the Page Name parameter I need the Web API Controller Name, and for Method Name parameter I need the action Method of the Controller that is called.
Also I need to know whether the user is authenticated or not.
Now Kindly let me know the settings defined in the Nlog config file are correct or not and also how to pass values to the other parameters.
All possible layout renderers could be found here.
You could use the following renderers:
Web API Controller Name: ${aspnet-MVC-Controller}
Method Name: you could use the ${callsite} or ${aspnet-mvc-action}
isAuthenticated: ${identity:isAuthenticated}
PS:
All parameters to the database target are string parameters
This question already has answers here:
The type 'RestService.weddingservice', provided as the Service attribute value in the ServiceHost directive could not be found
(6 answers)
Closed 7 years ago.
The error is:
The type 'WF.XXX.WebServices.XXXXService', provided as the Service
attribute value in the ServiceHost directive, or provided in the
configuration element
system.serviceModel/serviceHostingEnvironment/serviceActivations could
not be found.
Stack Trace:
[InvalidOperationException: The type 'WF.XXX.WebServices.XXXXService',
provided as the Service attribute value in the ServiceHost directive,
or provided in the configuration element
system.serviceModel/serviceHostingEnvironment/serviceActivations could
not be found.]
System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String
constructorString, Uri[] baseAddresses) +52742
System.ServiceModel.HostingManager.CreateService(String
normalizedVirtualPath) +1459
System.ServiceModel.HostingManager.ActivateService(String
normalizedVirtualPath) +44
System.ServiceModel.HostingManager.EnsureServiceAvailable(String
normalizedVirtualPath) +623
[ServiceActivationException: The service
'/XXXXX/XXXXXService/XXXXService.svc' cannot be activated due to an
exception during compilation. The exception message is: The type
'WF.XXX.WebServices.XXXXService', provided as the Service attribute
value in the ServiceHost directive, or provided in the configuration
element
system.serviceModel/serviceHostingEnvironment/serviceActivations could
not be found..] System.Runtime.AsyncResult.End(IAsyncResult result)
+687598 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult
result) +190
System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult
ar) +304662
System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult
ar) +94
How to fix this error on the server?
Update on 9/18/2012:
I have Visual Studio 2012 and .NET Framework 4.5 installed on my machine but server has only .NET Framework 4.0. I am not sure if this matters, because I built the service with .NET Framework 4.0.
But strangely, I noticed a 4.5 feature when I run my project. It shows a URL to singleWSDL file, which is not available in .NET 4.0 version. Why does this show up when the project is built with .NET Framework 4.0? Here is the screenshot:
Update 9/19/12:
Here is the relavant web.config file:
<system.serviceModel>
<services>
<service name="XXXXService">
<!-- Use a bindingNamespace to eliminate tempuri.org -->
<endpoint address="" name="XXXXService"
binding ="basicHttpBinding"
bindingNamespace="#services.url#/XXXXService"
contract="WF.XXX.WebServices.XXXXService" />
</service>
</services>
<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"/>
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="None" mapClientCertificateToWindowsAccount="true" />
</clientCertificate>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
To answer your questions
(1) Make sure you have built your project and the the dll which contains the service type XXXXService is placed in the bin directory.
(2) Single Wsdl is a new 4.5 feature. Since 4.5 is an in-place upgrade of 4.0 you will get the benefit of ?SingleWsdl even if you target your project to 4.0. But when you deploy the same service on a machine with just 4.0 then you will not be able to get this. To get this on your service machine make sure you have 4.5 on that too.
Hope this helps.
Thanks!
I had the same problem and the cause was that I had changed the namespace in the code files IService1.cs and Service1.svc.cs but forgot to change the namespace in the Service1.svc file.
E.G. in service1.svc
< % # ServiceHost Service="WcfService2.Service1" % >
must be changed to:
< % # Service="NewNamespaceName.Service1" % >
You can build the solution without Visual Studio catching the typo error.
I had the same issue. In my case, simply deleting the bin and obj folders and rebuilding fixed the issue.
i am new to windows 8 metro application development , please let me help out in figuring out this issuse.
i want to consume web services in my metro application but the service reference url is dynamic.
i my app , the user will be given a provision to specify the url in a textbox , so i need to connect to that web service , that means the service reference url will be changing.
Till now i am connecting to web service in a traditional way like , giving a specific service reference by adding service reference and creating an instance and using that instance to call all the methods inside that web service .
but,
1) how should i consume web services if the service reference url is changing.
2)Access individual service methods inside that service (call that methods by passing some parameters as inputs).
Thanks in advance.
If you have the same service with different locations simply add it with "Add Service Reference..." and add the specified URL in the service client constructor:
var svc = new DataServiceClient("BasicHttpBinding_DataService",
"http://url.com/DataService.svc");
BasicHttpBinding_DataService is your (generated) binding name from the client config (automatically generated when doing "Add new Web Reference..."):
Example ServiceReferences.ClientConfig
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_DataService" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="TransportWithMessageCredential" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://localhost:44300/Services/DataService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_DataService"
contract="DataService.DataService" name="BasicHttpBinding_DataService" />
</client>
</system.serviceModel>
</configuration>
The code above can be used to change the address (e.g. https://localhost:44300/Services/DataService.svc) to one generated at runtime...
And have a look at this: http://blog.rsuter.com/?p=281
Hi I have the following in my web.config
<entityFramework>
<contexts>
<context type=" Dashboard.Domain.DataContext, Dashboard.Domain">
<databaseInitializer type="Dashboard.Domain.DataContextInitializer, Dashboard.Domain" />
</context>
</contexts>
the problem is that when I now try to scaffold via the gui tools in vs 2010 it throws a design time exception
Unable to retrieve meta data for 'entity type' Failed to set database initlizer of type 'Init type goes here' specified in app config. see inner exception
why does this happen it also happened with the EF 4.1 way of defining the intializer in config.
Thanks