Set Default Document when deploying Web Application with Visual Studio Setup Project? - visual-studio

I have created a Setup Project to deploy a Silverlight + WCF web app. Everything works nicely, except that the Application is created with a Default Document of default.aspx.
Could someone please tell me how - or even whether it's possible - to set the Setup Project to specify that Default Document should be index.html?

If you are working in IIS 7 then you can specify this from the web.config:
<system.webServer>
<defaultDocument>
<files>
<clear / >
<add value="index.html" />
</files>
</defaultDocument>
</system.webServer>

If you need to do this in IIS 6, you can do it from your setup project (presumably also for IIS7)
In the setup project open up the File System View and open the properties editor of the Web Application Folder. Locate the DefaultDocument property and set it to what you need. If you require multiple values, you can use a comma separated list (bit of luck there, I guessed it would work and it did!)

Related

asp.net imageurl uses physical path for testing

I know that we can't use physical path when the webpage is deployed.
But here is my problem: I'm developing an Application for C# winform and Asp.net webform, the Data folder for the app is huge and I need to put that folder separately from the projects' folders cause it would be convenient to backup my projects to Google drive. The C# winform is easy to link the physical path, but the asp.net webform forces me to put the Data folder inside the project.
My current solution is: putting the Data folder inside the asp.net webform project and link that folder to the C# winform. But it wouldn't be convenient to backup the webform.
But is there any way I can use physical path with asp.net webform just for testing?
Thanks for reading.
You can put the folder external to web app folder, then place the path in Web.Config Under AppSettings as
<appSettings>
<add name="Data_Folder_Path" value="C:\Path\to\Data\Folder" />
</appSettings>
Then in code behind or elsewheere you need the data path you use Configuration class to read the path value:
var dataFolderPath = System.Configuration.ConfigurationManager.AppSettings["Data_Folder_Path"]
You can make use of server.mappath as shown below
Server.MapPath("~/" + folderName + nameOfFile)
to get the location of the files.
You may save the names of the files on your database and retrieve them when needed.

How do I tell Visual Studio to Push Updated ".asp" Files to the Output Directory When Debugging/Tell IIS Express not to Cache Them

I have a project which is part ASP.net and part Classic ASP. Sometimes while while running the debugger (using IIS-Express) I will make a change to the classic code, save it and refresh the page (I have Chrome's "Disable cache" feature enabled) but the changes will not be reflected in the page. Sometimes the changes will appear after a few minutes or a few refreshes. However if I make a change to a css or js file the change will appear on the first refresh.
I thought IIS Express might be caching the file it's self as the document is parsed by the web server before being handed to the client so I added this to my Web.config (based on answers to this question How do I stop IIS from caching any files, ever, under any circumstances?) -
<caching enabled="false" />
</system.webServer>
and added my Web.Debug.config like this -
<system.webServer>
<caching enabled="false" />
</system.webServer>
and added this to my Web.Release.config
<system.webServer>
<caching enabled="true" />
</system.webServer>
but still no better.

How do I stop IIS from caching any files, ever, under any circumstances?

I do some web development for work and the biggest hit to my productivity comes from IIS. It caches files that will not update even when they are changed, unless I restart IIS. Specifically, I am referring to html, js, and css files. This problem forces me to stop and start my web application constantly. Since I have Windows 7 I believe I have ISS 7.5. I am using IIS Express. This is so frustrating that I'd prefer IIS to never cache anything, ever. I am fine with a solution that stops all forms of caching or just for the project I am working on.
IIS Manager is not available to me. It is not located in System and Security -> Administrative Tools -> IIS Manager like is suggested by https://technet.microsoft.com/en-us/library/cc770472%28v=ws.10%29.aspx. Also, searching for inetmgr in the Start Search box gets me no results. Because of this, I am looking for a fix to the IIS applicationhost.config file.
I have tried putting the following in my applicationhost.config which doesn't work:
<location path="ProjectName">
<system.webServer>
<staticContent>
<clientCache cacheControlCustom="public" cacheControlMode="DisableCache" />
</staticContent>
<caching enabled="false" enableKernelCache="false"></caching>
</system.webServer>
</location>
The closest question on StackOverflow to my problem was IIS cached files never replaced. However, Fiddler shows me that the old files are being sent to the browser even after they have been changed.
How can IIS to send my browser the updated files without having to restart it?
I suspect that you have enabled output caching, this would exhibit the behaviour that you are describing where recycling the app pool or restarting IIS clears them and allows you to see the new content.
This page gives more information, http://www.iis.net/learn/manage/managing-performance-settings/walkthrough-iis-output-caching
If you are using IIS Express then it is likely that the caching is set at the application level in your web.config, or on individual pages.
You need to set
<caching>
<outputCache enableOutputCache="false" />
</caching>
or if its IIS 7+ (Which IIS Express will be)
<system.webServer>
<caching enabled="false" />
</system.webServer>
If anyone stumbles upon this and wants a "mouse click" way of disabling cache in IIS 7 or so... here's an answer from IIS forums on https://forums.iis.net/t/959070.aspx :
Here's an update for IIS 7.5 (in Windows 7). Disabling the cache is a
good thing to do during development when you're not concerned with
performance and want to see changes take place immediately. It speeds
up the development process.
- Start IIS Manager (type IIS into search programs and files in start menu)
- Navigate to desired site in the Connections tree (Default Web Site)
- Open Output Caching
- Edit Feature Settings
- Uncheck Enable cache and Enable kernel cache
You get a setting in web.config file something like this:
<caching enabled="false" enableKernelCache="false">
<profiles>
<add extension=".css" policy="DontCache" kernelCachePolicy="DontCache" />
<add extension=".script" policy="DontCache" kernelCachePolicy="DontCache" />
</profiles>
</caching>
So, no tag here..
Quite possible it's the browser which is the culprit.
Have you tried ctrl+ F5 ?

what does status=2147746065 mean? firefox error

I am trying to pull a font file using #font-face but firefox does not pick up the font and it gives this error status=2147746065. it doesn't really tell me what is wrong. Does anyone know what this means?
I'm fairly certain it just means that the font could not be obtained.
I recently fixed this issue by ensuring the font was on the server (Visual studio had an incorrect build type on the font; it should have been 'Content'.
I also needed to set up a mime type in IIS as
application/x-font-woff .woff
or put it in your web.config as
<system.webServer>
<staticContent>
<mimeMap fileExtension=".woff" mimeType="application/x-font-woff" />
</staticContent>
</system.webServer>
Also note that this mimeType is not recognised as a standard at present.
I had the same problem. Try disabling the extension (for example WIFI finder or another), then restart. The problem with error 2147746065 disappears.

Intellisense in .aspx for new tags added to the web.config pages/controls element

When I add an element in the controls node, the .aspx doesn't reflect it immediately. Often, down the road in the development, it will show up (when I could have used it before).
Obviously Visual Studio uses a cache somewhere. How do I refresh that cache so I can get intellisense in the .aspx for properties and what not?
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.DomainServices.WebControls" assembly="System.Web.DomainServices.WebControls"/>
</controls>
</pages>
Try adding the assemblies in the Web.config too (assuming it is a different assembly to your main one):
<add assembly="System.Web.DomainServices.WebControls, Version=...."/>
Obviously you will be getting errors in the code behind. Comment the code causing error. Build the solution.Then uncomment the code. Build the solution. See whether it is working

Resources