IIS is not sending digital signature property in downloaded static Exe file - iis-8

I signed my .exe file and deployed on IIS web server.I can see server Exe file contains digital signature but when I download this file on my local machine using static IIS URL, the downloaded file is missing digital signature.
I checked on other web server (Production Server) the IIS sends digital signature property with downloaded file. I am not getting what IIS setting is missing on my server.
looks like some IIS setting will do a trick may be MIME type ? Can any one please help on this ?

Related

How to publish WCF service on IIS 7

I have developed and published (via the "publish" feature in VS 2013) a simple WCF web service on IIS on my local machine.
The physical deploy path is the folder : c:\inetpub\wwwroot\MyWCF_Service_On_IIS\
I saw on IIS that the virtual folder has been created under "default Web site" (with the same name : MyWCF_Service_On_IIS). The default web site listens on port 80.
Why there is no way to access the service ? whatever combination of paths and urls fails.
I tried :
localhost/MyWCF_Service_On_IIS/Service1.svc (Service1.svc is the .svc file hosting the only endpoint);
localhost/Service1.svc
127.0.0.1/MyWCF_Service_On_IIS/Service1.svc
127.0.0.1/Service1.svc
localhost
127.0.0.1
Even if I don't expose metadata endpoints I expect to see a least a help page about the service and how to get the metadata themselves.
But I only get errors
Whatever attempt I do fails miserably.
I would like to know, once and for all, what is the rule IIS uses to map virtual folders to physical folders.
We are supposed to directly deploy all related files/file directories to the root folder of the website by using FileSystem mode.
C:\inetpub\wwwroot
Moreover, we need to enable windows features to handle the SVC extension for supporting WCF service.
There is no need to use a virtual folder in that case.
Here is the content of the wwwroot folder on my side.
bin folder
PrecompiledApp.config
Service.svc
Web.config
The service URL is http://localhost/service.svc
If we specify the URL by using a virtual path. We should convert the virtual path to the application.
Then the service URL is http://localhost/MyWCF/Service1.svc.
Feel free to let me know if the problem still exists.

IIS is not allowing to access a javascript file

i have a web application. while running in my system integration environment, i get an issue while accessing my javascript file or an image file in my particular folder.
When i tried putting the complete URL in the browser, it gave me a following exception -
HTTP Error 404.2 Not Found
The page you are requesting cannot be served because of the ISAPI and CGI Restriction list settings on the webserver.
I googled this exception and found that i need to allow ASP.NET 4.0, 2.0, etc in the IIS's ISAPI & CGi Restrictions.. however, they were already in allow mode.
What next should i lookup?
OK,, i got the answer
the HTTP Handler in the applicatin's web.config file was trying to execute via a aspnet_isapi.dll located in Framework64 folder of .NET Framework.. the target machine however is a 32 bit and i dont have this Framework64 folder on it..
i changed the path of the executable to point to the 32 bit's folder and it wrked :)

utf-8 filename are ruined when uploading through IIS

When I upload files with UFT-8 file name through IIS on my Windows Server file names are ruined. (They are changed as if they are encoded in ASCII and therefore they are no more accessible). I Wonder if there is any work around for this problem. I should also mention that my Windows Server doesn't have any issue with UTF-8 file names and I can create them through RDP or FTP. The problem only occurs when uploading through IIS.
Configuration:
OS: Windows Server 2008 SP1
Web Server: IIS 7.5
Uploading by PHP script executed through fastcgi
I think, the problem is the IIS. The IIS converts all request data to ascii before sending them to the PHP process. Because of this conversion all special characters of the utf-8 encoded request will be destroyed.
The IIS supports to change this procedure:
https://www.iis.net/learn/application-frameworks/install-and-configure-php-on-iis/configuring-the-fastcgi-extension-for-iis-60#utf8servervars
Additionally to this, PHP has problems to handle utf-8 in filenames on windows. This Bug has been fixed with PHP 7.1:
https://bugs.php.net/bug.php?id=33350
I solve the problem with changing the settings in IIS and upgrade to PHP 7.1.

How to use SSL with HttpListener with an mkbundle'd Mono app

I have a .NET application built with Mono, that I've bundled into a native (Linux) executable using mkbundle. This is so that end users don't need to mess around and install Mono themselves.
The application uses ServiceStack, which under the hood uses HttpListener. I need the web services to be exposed over an SSL-enabled HTTP endpoint.
Normally, you would run something like httpcfg -add -port 1234 -p12 MyCert.pfx -pwd "MyPass" during configuration (all this really does is copy the certificate to a specific path), and HttpListener would automatically bind the certificate to the port.
So HttpListener loads certificates from a particular path at runtime.
Is that path hard-coded? Or is there some way I can tell it to use a certificate from another location, since the end user will not have Mono installed?
Yes the path that HttpListener expects to find certificates at is predefined, and cannot be specified by the user, programatically or through a config file. The Mono EndPointListener class will look for the path:
~/.config/.mono/httplistener/
HttpListener code:
string dirname = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData);
string path = Path.Combine (dirname, ".mono");
path = Path.Combine (path, "httplistener");
As you have noted this is the same path the httpcfg copies certificates to.
Even though you are using mkbundle, this is still where HttpListener will expect to read the certificate from, regardless of the fact that the Mono runtime is installed.
In your application startup, you should:
Check for the existence of the directories, and create as required
Write your certificate and key to that path from an embedded resource in your application. PouPou's answer here shows the method used by HttpCfg.exe.
Therefore eliminating the requirement to run httpcfg, you will effectively be building that functionality straight into your application.
Does Mono perform any validation of the certificates it loads from there for HttpListener? i.e., will it expect to find the issuer's certificate in the certificate store?
I don't know for sure if Mono checks for a valid corresponding issuers certificate in the certificate store at the point of creating the listener, or upon each connection request. However you can add a CA cert to the certificate store yourself, or import all the standard Mozroot certificates.
The full source code for Mozroots is here. This shows how to import the CA certs.
Is the path to the certificate store also hard-coded?
The certificate store should be managed through the X509StoreManager provider.

WCF Certificate issue

I am developing a WCF service on my local computer using Visual Studios built in ASP.NET development sever and I'm having issues creating and using temporary Certificates.
I have created a cert call TempCA and added it to the Trusted Root Certificate folder and I have created another called SignedByCA which has been added to the personal folder.
The service config file has been set up to use SignedByCA but when I run the service I get the following error.
The certificate 'CN=SignedByCA' must have a private key that is capable of key exchange. The process must have access rights for the private key.
I have tried using WinHttpCertCfg.exe to give other users access to the key but I have since found out that WinHttpCertCfg.exe has be deprecated in windows Vista.
Has anyone had this issue before in a similar circumstance??
Try certmgr. But I suppose you used the makecert to generate the certificate, you don't need to use WinHttpCertCfg to install it. It should be installed automatically.
Also, if you are hosting the service in IIS, the private key is normally generated in
C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys
You can try granting read-only security of the MachineKeys for the user "NETWORK SERVICE" (user for IIS6).