6

I have a problem with my web application. I develop using VS 2013 (run as Administrator) and Windows 8.

When I debug using IIS Express - everything works fine, without any errors (I run VS as Administrator). When I change project properties to use Local IIS (it's installed) - I cannot use external library which is placed in GAC (Microsoft.FlightSimulator.SimConnect). Also I run VS as Administrator. Thrown error: "HRESULT E_FAIL has been returned from a call to a COM component" - this says nothing to me. This is thrown during creating new SimConnect object:
var simconnect = new SimConnect(...)
OFC, to use SimConnect, firstly Microsoft Flight Simulator should be launched (and it's started). This was proposed reason of the problem which I found in the Internet - second one was granting permissions (described below).

Details: I have two projects in solution: library project (which is used to connect to the FSX) and web project (MVC - to present the results).
1) I tried to move whole library project content to the MVC project - nothing.
2) I used IIS manager to publish my website (with the seperate AppPool) - result the same as for Local IIS.
3) I granted permissions to the folder (where projects are placed) for my own AppPool and also for IUSR, IIS_IUSR and DefaultAppPool - full access. And nothing.
4) I ran FSX as Administrator - also nothing :/

I found the workaround: I moved the library project to the another project - console application where I used HttpSelfHostConfiguration to host that. And later, I call this api from the main project (MVC). For this solution everything works fine (I tested for Local IIS [debugging] and also for IIS Manager). I have to only run the Host Api project as Administrator.

I'm very curious what is the reason of the exception. And additionally: how to resolve that :)

It seems like the problem with the permissions - but I granted to the every used AppPool.
Can be the reason lack of permissions for dll in GAC? I don't think so, but I have no idea what to do. If yes, how to grant permissions for dll in GAC (or how to copy that)?

9
  • is the web application running under full trust? Commented Jun 27, 2015 at 20:24
  • So you app requires Flight Simulator to run? This may work when using a user-mode process like IIS Express but who do you make sure it's running when nobody is logged on. Having a dependency on GUI processes from your IIS based applications is not a good idea and may not work. Commented Jun 28, 2015 at 4:33
  • @Proxytype I've added: <securityPolicy> <trustLevel name="Full" policyFile="internal"/> </securityPolicy> according to this (did you mean that?): msdn.microsoft.com/en-us/library/wyts434y(v=vs.140).aspx And still nothing for Local IIS :/ Commented Jun 28, 2015 at 13:35
  • @PeterHahndorf Yes, my app requires FSX to run. My purpose was to create an app to present the current flight on the website - one person plays in FSX (flies) and somebody else watches his flight (in the same network) on the site (e.g. on the phone). Website is run on the same computer where FSX. I found only solution mentioned in the Question above, but I'm curious: can I resolve that without separate host application (it's working and I'm happy with that :) )? Or maybe should I choose different way to present View with the flight data in the network? Commented Jun 28, 2015 at 13:41
  • @That's a special requirement you have, which I never came across. If it works with IIS Express, why don't you just use that. I think it is possible to make it available to remote machines. Commented Jun 28, 2015 at 14:03

3 Answers 3

7

@Krzyrok, Had the same issue recently on my one of my projects where I used external libraries. After following endless crumbs I got it resolved. Change your application pool identity from "ApplicationPoolIdentity" to "LocalSystem". I also changed the sites Anonymous Authentication to "Application pool identity" from the specified IUSR but tested it and it can be left on IUSR. I also granted permissions to the folder for IUSR and IIS_IUSR.

Sign up to request clarification or add additional context in comments.

Comments

0

If someone comes across this problem, it is possible that the problem is that you have not configured SSL for your localhost site. The site might be trying to communicate via https port 443 and it cannot find the site there. The site may be hosted only on the unsecure http port. To solve this problem,

  1. Go to IIS Manager
  2. Right Click on the Website
  3. Click on Bindings on the right
  4. Click on Add
  5. Select https
  6. Select the IIS Express certificate
  7. Click OK

Comments

0

I was using the physical path of the \bin folder as the basic settings physical path of the web site in IIS. I forgot I had to publish the web service and use the publish path as the basic settings physical path of the IIS website.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.