I've seen questions like this in my search but I still can't figure it out. I can run my WCF on localhost and call the methods in a simple html so I know it works.
This is the webconfig:
<?xml version="1.0"?> <configuration> <appSettings> <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" /> </appSettings> <system.web> <compilation debug="true" targetFramework="4.6.1"/> <pages validateRequest="false" /> <httpRuntime targetFramework="4.6.1"/> </system.web> <system.serviceModel> <behaviors> <serviceBehaviors > <behavior name="ServiceBehavior"> <!-- To avoid disclosing metadata information, set the values below to false 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> <services> <service name="WCFBolig.Service1" behaviorConfiguration="ServiceBehavior"> <endpoint binding="webHttpBinding" contract="WCFBolig.IService1" behaviorConfiguration="web"/> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> </service> </services> <serviceHostingEnvironment multipleSiteBindingsEnabled="true" /> </system.serviceModel> <system.webServer> <modules runAllManagedModulesForAllRequests="true"/> <!-- To browse web app root directory during debugging, set the value below to true. Set to false before deployment to avoid disclosing web app folder information. --> <directoryBrowse enabled="true"/> </system.webServer> <connectionStrings> <add name="DatabaseConnection" connectionString="server=XX;database=XX;user=XX;password=XX" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>
I'm not really sure if I need the "mex" endpoint tbh.
When I try to host it on IIS I right-click on Sites, add website, Give it a name and a port, I'm not sure about the physical path though. I've tried with the path just straight to the project: C:\Users\me\source\repos\WCFBolig\WCFBolig
I get this error when I try and browse:
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. Detailed Error Information: Module IIS Web Core Notification Unknown Handler Not yet determined Error Code 0x80070005 Config Error Cannot read configuration file due to insufficient permissions Config File \\?\C:\Users\me\source\repos\WCFBolig\WCFBolig\web.config Requested URL http://localhost:777/ Physical Path Logon Method Not yet determined Logon User Not yet determined Config Source: -1: 0:
I've tried moving the folder somewhere else to see if it could access it there but that didn't work. I've tried looking at the permissions for the webconfig file but I can't see anything to do with IIS.
What are the right steps to take? Please let me know if i need to post more info about the project, thank you for your time in any case.
Edit: New error hurray:
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. Detailed Error Information: Module IIS Web Core Notification BeginRequest Handler Not yet determined Error Code 0x80070021 Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false". Config File \\?\C:\inetpub\WCFBolig\WCFBolig\web.config Requested URL http://localhost:7778/Service1.svc Physical Path C:\inetpub\WCFBolig\WCFBolig\Service1.svc Logon Method Not yet determined Logon User Not yet determined Config Source: 38: <system.webServer> 39: <modules runAllManagedModulesForAllRequests="true"/> 40: <!--
I followed the answer from here: Config Error: This configuration section cannot be used at this path None of them were checked so I checked all but CGI, now get this error:
HTTP Error 404.3 - Not Found The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map. Most likely causes: It is possible that a handler mapping is missing. By default, the static file handler processes all content. The feature you are trying to use may not be installed. The appropriate MIME map is not enabled for the Web site or application. (Warning: Do not create a MIME map for content that users should not download, such as .ASPX pages or .config files.) If ASP.NET is not installed. Things you can try: In system.webServer/handlers: Ensure that the expected handler for the current page is mapped. Pay extra attention to preconditions (for example, runtimeVersion, pipelineMode, bitness) and compare them to the settings for your application pool. Pay extra attention to typographical errors in the expected handler line. Please verify that the feature you are trying to use is installed. Verify that the MIME map is enabled or add the MIME map for the Web site using the command-line tool appcmd.exe. To set a MIME type, use the following syntax: %SystemRoot%\windows\system32\inetsrv\appcmd set config /section:staticContent /+[fileExtension='string',mimeType='string'] The variable fileExtension string is the file name extension and the variable mimeType string is the file type description. For example, to add a MIME map for a file which has the extension ".xyz": appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain'] Warning: Ensure that this MIME mapping is needed for your Web server before adding it to the list. Configuration files such as .CONFIG or dynamic scripting pages such as .ASP or .ASPX, should not be downloaded directly and should always be processed through a handler. Other files such as database files or those used to store configuration, like .XML or .MDF, are sometimes used to store configuration information. Determine if clients can download these file types before enabling them. Install ASP.NET. Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here. Detailed Error Information: Module StaticFileModule Notification ExecuteRequestHandler Handler StaticFile Error Code 0x80070032 Requested URL http://localhost:7778/Service1.svc Physical Path C:\inetpub\WCFBolig\WCFBolig\Service1.svc Logon Method Anonymous Logon User Anonymous
So I've figured it out and it was pretty much what I've read on other stackoverflow threads, I just needed to follow them properly.
I thought I might have to start a new project as WcFService Library but I couldn't get that to work. Instead I just deleted the Service1.svc(with a codebehind-file), created a new Service1.cs file and copied the text from the past Service1.svc into it. Created a new Service1.svc with this as content: <%@ ServiceHost Service="WCFBolig.Service1" %>
I also had to add it as an application, not as a new website like i tried to do.
User contributions licensed under CC BY-SA 3.0