I am using a wcf service to provide some data to my clients to plot a graph .I have seen some thing and created the service But when I run it is showing following error.How to over come it?
The type 'WcfService2.Servi', provided as the Service attribute value in theServiceHostdirective, or provided in the configuration elementsystem.serviceModel/serviceHostingEnvironment/serviceActivationscould not be found.
this is my web.config file
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfService2.Servi" behaviorConfiguration="WcfService1.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="webHttpBinding" contract="WcfService2.Servi" behaviorConfiguration="web" bindingConfiguration="crossDomain">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.Service1Behavior">
<!-- 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>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="crossDomain" crossDomainScriptAccessEnabled="true" />
</webHttpBinding>
</bindings>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Your service contract type is called WcfService2.Servi. This looks like a typo. If you correct this, does the service work?
Related
When hosting WCF service on IIS using svc, the endpoints are ignored and only a default one is created.
Why is that and how to I make the endpoints work?
My setup:
service.svc
<%#ServiceHost language=c# Debug="true" Service="ComputerStudyService.SectionHandlerService"%>
web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyServiceTypeBehaviors">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="ComputerStudyService.SectionHandlerService" behaviorConfiguration="MyServiceTypeBehaviors">
<endpoint address="/" binding="wsHttpBinding" contract="ServicesLibrary.ISectionHandlerService"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="/mex"/>
</service>
</services>
</system.serviceModel>
</configuration>
When I navigate to http://localhost:24906/service.svc
I get the message telling me I created a service and I can go http://localhost:24906/service.svc?wsdl to get the meta.
However the metadata doesn't give me any of my endpoints!
<wsdl:service name="SectionHandlerService">
<wsdl:port name="WSHttpBinding_ISectionHandlerService" binding="tns:WSHttpBinding_ISectionHandlerService">
<soap12:address location="http://localhost:24906/service.svc"/>
<wsa10:EndpointReference>
<wsa10:Address>http://localhost:24906/service.svc</wsa10:Address>
<Identity xmlns="http://schemas.xmlsoap.org/ws/2006/02/addressingidentity">
<Upn>Roi-PC\Roi</Upn>
</Identity>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
Any help would be much appreciated.
I have a WCF service which works great when small data has to be transferred over the wire. When I increase the data to a bigger size, I get following error:
The remote server returned an unexpected response: (400) Bad Request.
I know that this question has been asked many times be other user. But, I have tried all of those approaches to fix this issue. Nothing is working for me. Can you please have a look at my config contents and let me know if I am missing something. Following is my services' config file.
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="RecieveValidationResultHubServiceLibrary.ReceiveValidationResultHubService">
<endpoint address="" binding="basicHttpBinding" contract="RecieveValidationResultHubServiceLibrary.IReceiveValidationResultHubService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8735/Design_Time_Addresses/RecieveValidationResultHubServiceLibrary/ReceiveValidationResultHubService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>
</system.serviceModel>
</configuration>
Following is service reference config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
<add key="MaxParallelThreads" value="300"/>
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IReceiveValidationResultHubService" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" maxBufferSize="2147483647" transferMode="Streamed"/>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8735/Design_Time_Addresses/RecieveValidationResultHubServiceLibrary/ReceiveValidationResultHubService/"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IReceiveValidationResultHubService"
contract="ReceiveValidationServiceReference.IReceiveValidationResultHubService"
name="BasicHttpBinding_IReceiveValidationResultHubService" />
</client>
<services>
<service name="StartValidationClientServiceLibrary.StartValidationClientService">
<endpoint address="" binding="basicHttpBinding" contract="StartValidationClientServiceLibrary.IStartValidationClientService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8734/Design_Time_Addresses/StartValidationClientServiceLibrary/StartValidationClientService/" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information,
set the values below to false before deployment -->
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="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>
</system.serviceModel>
</configuration>
If error is about max reader quota, kindly make the change in web.config under your binding. See if it works.
<binding maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<readerQuotas maxDepth="32" maxStringContentLength="2147483647"
maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
</binding>
I have a WCF Service where it has one endpoint and I have the service contract and operation contract setup in the config file but when I run the service, it cannot find the endpoint although I configured it in the web.config.
This service will be setup in IIS so I have no base address setup.
The ServiceContract has a configuration name of agent_port_type and the service behavior has a configuration name of agent_service. I am using basicHttpBinding.
Below is a copy of part of my config file:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="ETAOutboundServiceBehavior">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<behavior name="Metadata">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="ETAOutboundServiceBehavior" name="agent_service">
<clear />
<endpoint address="" name="agent_interface" binding="basicHttpBinding" contract="agent_port_type"
listenUriMode="Explicit" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
listenUriMode="Explicit" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
Any help would be appreciated. I had it working on a different service fine but then I used svcutil to create agent_port_type and it is not working.
You should try simplifying the config to something that Works, then add extra options as need.
Start With:
Remove Clear tag
Remove all References to HTTPS
Remove listenURIMode
Add an address for the endpoint
Check the IIS log that you are calling the service that you think you are calling
Add a syntax error to Your config and check that it fails (to make sure that the config file you are editing is the one being used)
Hosting in IIS,web.config
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true">
</compilation>
<authentication mode="Forms"/>
</system.web>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="AllenBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="mexBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
<serviceThrottling maxConcurrentCalls="1000" maxConcurrentSessions="1000" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="jqueryWCF.WCFservice" behaviorConfiguration="mexBehavior">
<host>
<baseAddresses>
<add baseAddress="http://127.0.0.1:9999/Service"/>
</baseAddresses>
</host>
<endpoint address="" behaviorConfiguration="AllenBehavior" binding="webHttpBinding" contract="jqueryWCF.WCFservice" />
<endpoint address="mex" binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
</system.serviceModel>
1 web page access success by JQuery ajax
2 Metadata is also released, the URL access success;
*But why the console app add service reference will appear "object reference not set to an instance of an object"????*
Looks like something wrong with metadata of your WCF service.
Check operations contracts definition.
Do not you have conflicting contract names?
Try to use ServiceModel Metadata Utility Tool (Svcutil.exe) to generated client code from WSDL instead of Visual Studio tool
I am trying to publish my duplex wcf service on a server with no success, I am able to publish it on local IIS, but when I publish it to server its address become net.tcp://win-rhkt30stjd7/Broadcastor/BroadcasterService.svc. As you would agree such address is not useful at all while creating the service reference on client. I tried to publish it as WCF application project, and service library project but both is giving the same result. Probably something is missing from my Web.config file but I don't know what it is. Please help me out here. Below is my Web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="false" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<services>
<service name="BroadcastorServiceApp.BroadcastorService">
<endpoint binding="netTcpBinding" contract="BroadcastorServiceApp.IBroadcastorService">
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>
</services>
<bindings>
<netTcpBinding>
<binding>
<security mode="None"></security>
</binding>
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
I dont see any address part in your NET TCP endpoint
1 : Add a base address as below :
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8088" />
</baseAddresses>
</host>
2 : add an address parameter to your net tcp endpoint as :
<endpoint address = "tcpEndPoint"
binding="netTcpBinding"
contract="BroadcastorServiceApp.IBroadcastorService"></endpoint>
3 : Alse give a behavior name as :
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
And add it to the service like :
<service name="BroadcastorServiceApp.BroadcastorService" behaviorConfiguration="ServiceBehavior">
<endpoint binding="netTcpBinding" contract="BroadcastorServiceApp.IBroadcastorService"></endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" />
</service>