Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't Hit a WCF webservice which is being published by Visual Studio
    text
    copied!<p><strong>UPDATE:</strong> I don't know if this helps anyone diagnose this issue but the wsdl has the end point as:</p> <pre><code>http://localhost:8523/Temp/WebService.svc/WebService.svc </code></pre> <p>Which is wrong, I've tried manually changing the endpoint to remove the extra bit at the end and it still returns a 404</p> <p><strong>/Update</strong></p> <p>I'm working on a web service using WCF, when I run the VS2010 debugger I get the following error message:</p> <blockquote> <p>The target assembly contains no service types. You may need to adjust the Code Access Security policy of this assembly.</p> </blockquote> <p>The solutions to this I've found online say that I should add [ServiceContract] to the interface but it's already there.</p> <p>I've also seen people say that I have to delete the tag from the csproj file but doing this makes the project a class library rather than a web service.</p> <p>But my browser opens to a directory listing and I can navigate to the wsdl generated by the container by clicking on the .svc file and then clicking on the link to .svc?wsdl </p> <p>If I try and hit the service from an application or from the WCF Service Tester I get an exception with a 404, I cbbled together a test app and here is the exception it gives me:</p> <pre><code>Sending Message: Make Call: InteractionId [rt], Destination [ert], ExternalReferenceId [ert], userIdentifier [ert] attachedData [rt] System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:8523/WebService.svc?wsdl that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details. ---&gt; System.Net.WebException: The remote server returned an error: (404) Not Found. at System.Net.HttpWebRequest.GetResponse() at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout) --- End of inner exception stack trace --- Server stack trace: at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout) at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout) at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout) at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout) at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout) at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout) at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type) at Sabio.Avaya.AACC.ProxyServiceLibary.IProxyService.MakeCall(MakeCallRequestData MakeCallRequestData) at Sabio.Avaya.AACC.ProxyServiceLibary.WSPipeProxyClient.MakeCall(MakeCallRequestData MakeCallRequestData) in C:\Users\me\Documents\Visual Studio 2010\Projects\WebService\RemoteClientLib\WSPipeProxyClient.cs:line 42 at ClientLibTestUI.WcfTestApp.MPCWSButton_Click(Object sender, EventArgs e) in C:\Users\me\Documents\Visual Studio 2010\Projects\WebService\ClientLibTestUI\Form1.cs:line 97 </code></pre> <p>Here is my Web.config:</p> <pre><code> &lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;system.web&gt; &lt;compilation debug="true" targetFramework="4.0" /&gt; &lt;/system.web&gt; &lt;system.serviceModel&gt; &lt;services&gt; &lt;service name="WebService" behaviorConfiguration="WebServiceBehaviour"&gt; &lt;endpoint address="WebService.svc" binding="wsHttpBinding" bindingConfiguration="DefaultWSBinding" name="WSEndPoint" contract="IWebService"&gt; &lt;identity&gt; &lt;dns value="localhost" /&gt; &lt;/identity&gt; &lt;/endpoint&gt; &lt;endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" bindingConfiguration="mexHttpBinding"/&gt; &lt;host&gt; &lt;baseAddresses&gt; &lt;add baseAddress="http://localhost/Temp/"/&gt; &lt;/baseAddresses&gt; &lt;/host&gt; &lt;/service&gt; &lt;/services&gt; &lt;bindings&gt; &lt;netTcpBinding&gt; &lt;binding name="DefaultNetTcpBindingConfig" maxConnections="5" portSharingEnabled="true" &gt; &lt;security mode="None"/&gt; &lt;/binding&gt; &lt;/netTcpBinding&gt; &lt;wsHttpBinding&gt; &lt;binding name="DefaultWSBinding"&gt; &lt;security mode="None"/&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;mexHttpBinding&gt; &lt;binding name="mexHttpBinding"/&gt; &lt;/mexHttpBinding&gt; &lt;/bindings&gt; &lt;behaviors&gt; &lt;serviceBehaviors&gt; &lt;behavior name="ServerServiceBehaviour"&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;!-- 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 --&gt; &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt; &lt;/behavior&gt; &lt;behavior name="MexBehaviour"&gt; &lt;serviceMetadata httpGetEnabled="true" policyVersion="Policy15"/&gt; &lt;/behavior&gt; &lt;behavior name="WebServiceBehaviour"&gt; &lt;!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; &lt;!-- 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 --&gt; &lt;serviceDebug includeExceptionDetailInFaults="false"/&gt; &lt;/behavior&gt; &lt;/serviceBehaviors&gt; &lt;/behaviors&gt; &lt;serviceHostingEnvironment multipleSiteBindingsEnabled="true" /&gt; &lt;/system.serviceModel&gt; &lt;system.webServer&gt; &lt;modules runAllManagedModulesForAllRequests="true"/&gt; &lt;/system.webServer&gt; &lt;/configuration&gt; </code></pre> <p>Can someone tell me what I might be doing wrong? I get a similar problem if I host in IIS or the built in webserver in VS2010</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload