Deploying IIS, ASP.net with oracle database - asp.net

Good day!
After watching a video I was able to summarize the steps I needed as such:
Steps in configuring and deploying to IIS ASP.NET
1. Create directory
example:
C:/inetpub/wwwroot/mvcauction
Open internet information services Manager
Right-click default website
Add application.
Choose website name.
example mvcauction
Paste the directory you created in step 1.
Click select button.
Make sure that the property has .net framework version 4.0
Click ok.
Go to your visual studio IDE.
Righ-click on the project file in the solution explorer.
CLick publish
Click publish profile drop down and select new. Add a profile name.
Example:
Local IIS Website
Choose publish method File System
Use step one's directory for the Target location
configuarion: Release
Choose local IIS Website.
Expect an error.
Open visual studio command prompt.
Execute this command: sqllocaldb share v11.0 IIS_DB
Update your web config. Refer to the paint screenshot.
Publish again in iis manager.
if not yet ok:
Go to visual studio again.
Open data base explorer.
Right-Click to data connections to add connection.
For the server name: Enter the value that we are using in the config file data source.
Example
(LocalDB).\IIS_DB
Click ok
Righ-Click on the new connection added.'
Choose new query.
Execute the shown commands.
Go to the browser and refresh.
However I cannot finish step 21 which I conclude is because the tutorial did not use oracle database as its data source. I cannot publish my visual studio project successfully. So, please, does anyone here know what to put in the web config file?
This is my web config file:
<configuration>
<system.web>
<compilation debug="true" strict="false" explicit="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<connectionStrings>
<add name="OracleConnectionString" connectionString="Data Source=localhost;USER ID=userid;PASSWORD=password"
providerName="Oracle.DataAccess.Client" />
<add name="ConnectionString" connectionString="Provider=MSDAORA;Data Source=localhost;Password=password;User ID=userid"
providerName="System.Data.OleDb" />
</connectionStrings>
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
</configuration>

Related

How to link an SQL Database in Visual Studio to Razor cshtml?

I was following this tutorial
https://learn.microsoft.com/en-us/aspnet/web-pages/overview/getting-started/introducing-aspnet-web-pages-2/displaying-data
but I am doing this in Visual Studio instead of WebMatrix since there is no more support for WebMatrix anymore. I tried creating a database within Visual Studio, but I'm not sure how to reference it with C#. Any help would be appreciated.
Also if possible link it to a Microsoft Access database.
If your DB is already configured on your project, you must first open the connection in your cshtml header or whatever
var db = Database.Open("DATABASENAME");
The Database must be connected with a few line in the Web.config page (This kind of informationS)
<connectionStrings>
<add name="DATABASENAME" connectionString="server=Servername;database=DATABASENAME;trusted_connection=True" providerName="System.Data.SqlClient" />
<add connectionString="Server=.\DATABASE STRING;Database=DATABASENAME;Trusted_Connection=True" name="DATABASE NAME" providerName="System.Data.SqlClient" />
</connectionStrings>

How will be visual studio deployment scnerio

I consumed about deployment for my projects. For example I am developing a asp.net web api or asp.net mvc project on visual studio. I use local database and local file usernames and password for ssl. I finish the development and publis it on my local iis server and see the working application. After local iis test, I load it to server but sometimes forget the change web.config settings, connectionstrings, ssl certificate paths and password. So the working server application that users accessed fails. How can I solve this problems?
What I do is I replace the configuration in the Web.Release.config using Transform
So if for example in my Web.config I have the following connection string:
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\sample.mdf;Initial Catalog=sample;Integrated Security=True" providerName="System.Data.SqlClient" />
</connectionStrings>
In my Web.Replace.config I update the connectionString for production like this:
<connectionStrings xdt:Transform="Replace">
<add name="DefaultConnection" connectionString="SERVER_CONNECTION" providerName="System.Data.SqlClient" />
</connectionStrings>
Though keep in mind that the Transformation that I did in Web.Replace.config only applies when you publish your web app. You won't be able to test it locally by just running your application in Debug/Release mode
You should implement Web.Config transformation. Check this MSDN link for more information.
Just to give an overview - by implementing Web.config transformation, your project will have different Web.Config file (For example, Web.config, Web.Live.config, Web.PreProd.Config, etc), i.e., each different file for diffrent build configurations. The main web.config should remain as it is. Its just the other config files where you will need to specify the configurations which you want to overwrite. Once done, if you publish with a particular build configuration, then the newly generated web.config (in publish folder) should have all configurations from web.config + the differences you would have specified in the transformed file for that build configuration.

Is there a "release" configuration for ASP.NET Web Sites?

I use Visual Studio for Website development (VS 2010 Ultimate and VS 2012 Professional). To be more specific, I created this website by File > New Web Site, so I do not believe this is a project.
While developing the website, I have debug="true" enabled in the web.config file. When I publish, I manually change to debug="false".
<configuration>
<system.web>
<compilation debug="true" strict="true" explicit="true" targetFramework="4.5">
</system.web>
</configuration>
There are two config files in the solution: "web.config" and "web.Debug.config".
This is what the various forum articles and "Programming ASP.NET" books say to do, but I wonder if there is a way to have debug="true" for local development and automatically switch to debug="false" when using Build > Publish Web Site so I don't have to manually change the web.config file?
According to this forum answer, "There is no way to have a Release configuration for your website."
Keeping in mind that this is a Web Site and not a project, it looks like adding another config based on comment suggestions might not be possible. A possibly valid answer is "no, it is not possible in this context."
Is there another way to achieve the intended outcome without using the current workaround of manually changing the debug setting?
Sorry, it's related to it being a "web site" type project, which aren't compiled:
Configuration of publishing an ASP.NET web site
To quote the previous responder above:
"Web Site projects don't have the Release configuration available, but it makes no difference since they are not compiled. Web Application projects, on the other hand, do get compiled and have both configurations available."
According to the available references, for "ASP.NET Website" it is not possible to have a separate release configuration.
So the answer to the posed question is no: it is not currently possible. Manually changing the debug attribute when you publish and then changing it back is the only option in that case.
How can you proceed? If you really need to have a release configuration and a debug configuration, the a possible option is Converting a Web Site Project to a Web Application Project. While not a direct answer to the presented question, it is an alternative.
For some projects I've set up an Environment appSetting and scoped all other keys off of that Environment.
For instance:
<add key="Environment" value="Development"/>
<add key="Development.Title" value="My Dev App"/>
<add key="Production.Title" value="My Production App"/>
<connectionStrings>
<add name="DbContext.Development" connectionString="Initial Catalog=DatabaseDev;...."
providerName="System.Data.SqlClient" />
<add name="DbContext.Production" connectionString="Initial Catalog=DatabaseProd;...."
providerName="System.Data.SqlClient" />
</connectionStrings>
Then you would create a Configuration class that would pull appSettings and connectionStrings by looking for:
appSetting
string.Format("{0}.Title", ConfigurationManager.AppSettings["Environment"])
connectionString
string.Format("DbContext.{0}", ConfigurationManager.AppSettings["Environment"])
Not perfect but this will let you only have to replace one web.config value instead of a bunch without the help of the Publish config transform.

.NET Web API 2 Project downloading browserLink.js

I've got a .NET Web API project and on load I'm getting a download of this script called browserLink.
http://localhost:49818/ea93983f23c54f35a63de09646c09159/browserLink
Its associated with .NET Signalr but I'm not using that so I'm not sure why its being included. Any ideas how to turn it off?
Disable Browser Link in Visual Studio 2013.
Do this by editing your web.config file to add the following line to your appSettings section:
<appSettings>
<add key="vs:EnableBrowserLink" value="false"/>
</appSettings>
Note that Browser Link is only used when working in Visual Studio AND the web application is compiled in debug mode, i.e.:
<system.web>
<compilation debug="true" />
</system.web>
In other words, end-users of your site will never make this request.

No more Intellisense for ASP tags visual studio 2010

I'm not getting intellisense for asp tags anymore in websites or web applications.
There is a check mark for the following:
Tools->Options->Text
Editor->C#->General->Auto list
members
Tools->Options->Text
Editor->C#->General->Parameter
information
Tools->Options->Text
Editor->C#->Intellisense->Show
completion list after a character is
typed
My dev environment is server 2008 R2 64 bit, VS 2010 Ultimate (ver 10.1.30319.1 RTMRel), I don't have resharper installed, but I do have AnkhSVN installed.
How do I get intellisense back?
UPDATE: Here is my webconfig:
<configuration>
<connectionStrings>
<add name="MerchandiseEntitiesContainer" connectionString="metadata=res://*/Merchandise.Entities.csdl|res://*/Merchandise.Entities.ssdl|res://*/Merchandise.Entities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=.\sqlexpress;Initial Catalog=OldOslernet;Integrated Security=True;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<httpRuntime executionTimeout="1800"
maxRequestLength="1048576"
useFullyQualifiedRedirectUrl="false" />
</system.web>
<appSettings>
<add key="upLoadPath" value="images/products/"/>
</appSettings>
</configuration>
Also, here is a pic of the editor:
http://img688.imageshack.us/img688/958/extension.png
Delete Schema Files
Delete all files in the following folder: C:\Users[UserName]\AppData\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas. It is safe to delete anything in this folder as Visual Studio will regenerate them as needed.
Unblock Referenced Assemblies
There could be a problem with one of the referenced assemblies in your project being blocked on your machine. Right-click on each DLL in Windows Explorer, select Properties, and click the "Unblock" button (if the DLL is being blocked.)
Reset Visual Studio Settings
If all else fails, you can try to reset your settings in Visual Studio 2010 (MSDN Link.) You'll have to tweak your settings all over again but it is worth trying.
This is what worked for me for aspx/ascx files:
Right click on the file in Solution Explorer
Select Open With
Select Web Form Editor (Default)
Click Set as Default
Check file extension - editor bindings in preferences.
Check the system.web\pages\controls config section in your web configuration file.
Check the system.web\compilation\assemblies section too.

Resources