I have a very simple service built in the class library type project called fn34-webservice.
Category for interface and service (they are in different files):
namespace fn34_webservice {[service contact] public interface IEstoqueWS {[Operation Contract] Item ESTOK GetQuantidade (string codigo); }} Namespace fn34_webservice {public class AstokuWS: IEstoqueWS {Personal dictionary & lt; String, item estoco> gt; Repositorio = New Dictionary & lt; String, item estoco> gt; (); Public Estocus () {repositorio.Add ("SOA", New Item Estoc ()} {codeogo = "SOA", quoted = 5}); Repositorio.Add ("TDD", New Item Estoc () {codeogo = "TDD", Quantidad = 1}); Repositorio.Add ("RES", New Item, Estoc () {codeogo = "RES", Quantidad = 2}); Repositorio.Add ("LOG", New Item, Estoc () {codeogo = "LOG", Quantidade = 4}); Repositorio.Add ("Web", New Item, Estoc () {codeogo = "Web", Quantidade = 1}); Repositorio.Add ("ARQ", New Item, Estoc () {codeogo = "ARQ", Quantidad = 2}); } Public Items ESTOK GetQuantidade (string codego) {return repository [codeogo]; }}}
Therefore, I create this simple blank web site to host the server and test it locally. I have added this configuration in the context of my project fn34-webservice and in the web.config of the website:
& Lt; / Behavior & gt; & Lt; / ServiceBehaviors & gt; & Lt; / Behavior & gt; & Lt; /system.serviceModel>
When I run it and try to access the URL http: // localhost: 49487 / WsHost / fn34- webservice.svc
: I get the following error Found: / P>
Type 'fn34-webservice.fn34-webservice', provided in the service service provided as value in the service value, or in the configuration element system. Service model / servicehosting environment / service activation could not be found.
My guess is that this is probably my web. Something is dumb in the config file, but I can not seem to find it.
Thanks a lot!
I think that you are using the wrong fully qualified name for your service.
In your config file, you have fn34- webservice.fn34-webservice
. However, your web service has actually been given the name Estocus
and the name space is fn34_webservice
( _
).
Try updating your config file to use fully qualified name fn34_webservice.EstoqueWS
, like this:
& Lt; Service activation & gt; & Lt; Add Factory = "System. Service Model. Activation. ServiceHostFeature" relative address = "./WSHost / fn34-webservice.svc" service = "fn34_webservice.EstoqueWS" / & gt; & Lt; / ServiceActivations & gt;
No comments:
Post a Comment