I solve the problem adding [ServiceBehavior(AddressFilterMode = AddressFilterMode.Any)] above the service implementation class.
HTTP Error 404.0 - Not Found IIS 7.5
-
15-10-2022 - |
Question
I have an WCF web service that I was able to call from an Android application in Visual Studio IIS server, but now after publishing the service in my local IIS server when I try to make a call from the application I receive the following error as response: "HTTP Error 404.0 - The resource you are looking for has been removed, had its name changed, or is temporarily unavailable." The ISAPI and CGI restrictions are all allowed *Calling the service from the URL in browser works normally* This is the first time that I try to make a service publication, any help will be welcome.
My web.config file:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<connectionStrings>
<add name="VendasEntities" connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=MySql.Data.MySqlClient;provider connection string="server=SERVER IP;User Id=user;password=pass;Persist Security Info=True;database=database"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="httpBehavior">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
<services>
<service name="FreedomVendasService.VendasService">
<endpoint address="" behaviorConfiguration="httpBehavior" binding="webHttpBinding" contract="FreedomVendasService.IVendasService" />
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
<system.diagnostics>
<sources>
<source name="System.ServiceModel"
switchValue="Information, ActivityTracing"
propagateActivity="true">
<listeners>
<add name="traceListener"
type="System.Diagnostics.XmlWriterTraceListener"
initializeData= "c:\log\Traces.svclog" />
</listeners>
</source>
</sources>
</system.diagnostics>
<host>
<baseAddresses>
<add baseAddress = "http://localhost/VendasService" />
</baseAddresses>
</host>
</configuration>
La solution 2
Autres conseils
Are you missing any Host element in the web.config like
<host>
<baseAddresses>
<add baseAddress = "http://localhost/service1" />
</baseAddresses>
</host>
Can you show me your web.config file.
Uncheck this in Windows Explorer.
"Hide file type extensions for known types"